Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Tue Jul 16, 2019 2:45 pm


Username:
Subject:
Message body:
Enter your message here, it may contain no more than 60000 characters. 

Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
Font size:
 
Font colour
Options:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Disable BBCode
Disable smilies
Do not automatically parse URLs
Confirmation code
Confirmation code:
In an effort to prevent automatic submissions, we require that you enter both of the words displayed into the text field underneath.
     

Topic review - Mysql> how to store select Zulu / UTC timestamp in database
Author Message
Post subject: Mysql> how to store select Zulu / UTC timestamp in database  |  Post Posted: Fri Dec 16, 2011 5:23 am
To obtain/store the current time in mysql, function "NOW()" needs to be used. But this takes into consideration the timezone set on the server.

To store the UTC time, in the same format, "UTC_TIMESTAMP()" function can be used:

Code:
mysql> select now();
+---------------------+
| now()               |
+---------------------+
| 2011-12-16 10:19:33 |
+---------------------+
1 row in set (0.00 sec)

mysql> select UTC_TIMESTAMP();
+---------------------+
| UTC_TIMESTAMP()     |
+---------------------+
| 2011-12-16 09:19:36 |
+---------------------+
1 row in set (0.05 sec)


P.S.: The column type for NOW() and UTC_TIMESTAMP() in mysql is "datetime".
Jump to:  
News News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO