How to get current server UTC time in JavaScript

Krishnan
   var k=new Date();
   alert(k);

It alert local time. But I need to display current server UTC time.

AB D CHAMP

JavaScript is basically on client side. You will not be able to get server time in java script as it will be executed on client and give you the server time only (Node.js is exception here).

If you really wish to have server time in javascript. You can write a Api or Webservice on serverside which will give you server time in format you want. Call this webservice/Api using XMLHTTP or Ajax request and parse the response and display the time as per your wish.

Ajax post Code Example :

        $.post( "Your Web Service Page", function( data ) {
          //Assuming that Your web service will not need any paramerter 
           and just write the server time in utc in response
          alert(data ); 

        });

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

JodaTime - how to get current time in UTC

From Dev

How to get current utc time in Lua script?

From Java

How can I get the current date and time in UTC or GMT in Java?

From Dev

How to get UTC time

From Dev

How to convert current UTC time into Linux Timestamp

From Dev

JavaScript -- get current date using UTC offset

From Dev

Why current UTC time on my local server and UTC time on my hosting server are different?

From Dev

How to get current offset from UTC to Eastern Daylight Saving time using momentjs?

From Dev

How can I convert float number into minutes to be added to the current UTC time with Javascript?

From Dev

how to get current UTC offset of different timezones?

From Dev

how to get current UTC offset of different timezones?

From Dev

How to get server time using javascript

From Dev

Get Current Date/Time with JavaScript

From Dev

How can I get exact UTC current time stamp at time4j without usage of system timezone and system clock?

From Dev

Powershell simplest method to get current time expressed as UTC

From Dev

Best way to get unix timestamp for current UTC time in MySQL

From Dev

How to get the start time and end time in utc of a day for a specified timezone in javascript?

From Dev

How to get current time in a format hh:mm AM/PM in Javascript?

From Dev

How to get UTC time without SimpleDateFormat?

From Dev

How to get the difference of UTC time in Tcl?

From Dev

How to get UTC time offsets from a geolocation

From Dev

How to get a timestamp in UTC but without the time?

From Dev

How to get UTC time offsets from a geolocation

From Dev

How to get UTC time with seconds in java?

From Java

How to get current time for timezone

From Java

How to get the current time as datetime

From Java

How to get the current time in Python

From Dev

How to get current time in jinja

From Java

How to get current time with jQuery

Related Related

  1. 1

    JodaTime - how to get current time in UTC

  2. 2

    How to get current utc time in Lua script?

  3. 3

    How can I get the current date and time in UTC or GMT in Java?

  4. 4

    How to get UTC time

  5. 5

    How to convert current UTC time into Linux Timestamp

  6. 6

    JavaScript -- get current date using UTC offset

  7. 7

    Why current UTC time on my local server and UTC time on my hosting server are different?

  8. 8

    How to get current offset from UTC to Eastern Daylight Saving time using momentjs?

  9. 9

    How can I convert float number into minutes to be added to the current UTC time with Javascript?

  10. 10

    how to get current UTC offset of different timezones?

  11. 11

    how to get current UTC offset of different timezones?

  12. 12

    How to get server time using javascript

  13. 13

    Get Current Date/Time with JavaScript

  14. 14

    How can I get exact UTC current time stamp at time4j without usage of system timezone and system clock?

  15. 15

    Powershell simplest method to get current time expressed as UTC

  16. 16

    Best way to get unix timestamp for current UTC time in MySQL

  17. 17

    How to get the start time and end time in utc of a day for a specified timezone in javascript?

  18. 18

    How to get current time in a format hh:mm AM/PM in Javascript?

  19. 19

    How to get UTC time without SimpleDateFormat?

  20. 20

    How to get the difference of UTC time in Tcl?

  21. 21

    How to get UTC time offsets from a geolocation

  22. 22

    How to get a timestamp in UTC but without the time?

  23. 23

    How to get UTC time offsets from a geolocation

  24. 24

    How to get UTC time with seconds in java?

  25. 25

    How to get current time for timezone

  26. 26

    How to get the current time as datetime

  27. 27

    How to get the current time in Python

  28. 28

    How to get current time in jinja

  29. 29

    How to get current time with jQuery

HotTag

Archive