Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get current ISO8601 date/time stamp

I would like to get the current date/time stamp of the server or client in ISO8601 format (ex. 31 Dec 2009, 02:53). I know that server time can be observed using PHP and brought into the DOM using jQuery $.getJson. Client side time can be recorded from the browser using javascript/jQuery. I want the time stamp to be static (not dynamic/real-time). Im php/JS newbie and would greatly appreciate your help. Thanks.

like image 645
Steve Avatar asked Dec 31 '09 18:12

Steve


People also ask

What is the current ISO 8601 time?

What is UTC Time in ISO-8601 Format? Current time: 13:28:38 UTC.

Is iso8601 same as UTC?

ISO 8601: It is a representation of dates to keep an international standard and avoid difficulties when handling dates and time. UTC: It is the official time standard to synchronize the clocks and keep precision in measurements and other activities.

Does ISO date have timezone?

ISO 8601 represents date and time by starting with the year, followed by the month, the day, the hour, the minutes, seconds and milliseconds. For example, 2020-07-10 15:00:00.000, represents the 10th of July 2020 at 3 p.m. (in local time as there is no time zone offset specified—more on that below).

How do I convert UTC time to my time?

(GMT-5:00) Eastern Time (US & Canada)Add the local time offset to the UTC time. For example, if your local time offset is -5:00, and if the UTC time is shown as 11:00, add -5 to 11. The time setting when adjusted for offset is 06:00 (6:00 A.M.). Note The date also follows UTC format.


1 Answers

In PHP 5, you can do

date("c"); //   ISO 8601 date (added in PHP 5)

see date

like image 146
Pekka Avatar answered Sep 20 '22 05:09

Pekka