Ivorde Unix/Linux/Database/Web/Mail Forum

View unanswered posts
View active topics
It is currently Thu Feb 23, 2012 7:13 am


Mysql Application & Query Optimization, Questions, Indexes, Bugs.

Bookmark this article:

Author Message
debuser
Post  Post subject: Mysql> how to store select Zulu / UTC timestamp in database  |  Posted: Fri Dec 16, 2011 12:23 pm

Joined: Thu Aug 06, 2009 9:48 am
Posts: 90

Offline
Save on Delicious
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".


Top
Display posts from previous:  Sort by  
Print view

Topics related to - "Mysql> how to store select Zulu / UTC timestamp in database"
 Topics   Author   Replies   Views   Last post 
There are no new unread posts for this topic. Mysql> select records that have date/datetime column equal to today's date

admin

0

180

Tue Nov 22, 2011 4:40 pm

admin View the latest post

There are no new unread posts for this topic. MySql doesn't start: libexec/mysqld: File './mysql-bin.index' not found (Errcode: 13)

debuser

0

1577

Mon Feb 22, 2010 8:43 pm

debuser View the latest post

There are no new unread posts for this topic. Mysql: add column to table

debuser

1

2818

Fri Oct 08, 2010 8:38 am

sonee4 View the latest post

There are no new unread posts for this topic. Rename MySql table

debuser

1

467

Fri Oct 08, 2010 8:36 am

sonee4 View the latest post

There are no new unread posts for this topic. MySql rename table

admin

2

343

Mon Nov 28, 2011 10:39 am

Darwin View the latest post

 

Who is online
Users browsing this forum: No registered users and 0 guests
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
cronNews 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 + 2 hours [ DST ]

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
DAJ Glass 2 template created by Dustin Baccetti

phpBB SEO