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

FAQ
It is currently Wed Oct 18, 2017 5:04 pm


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

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

Joined: Thu Aug 06, 2009 2:48 am
Posts: 105

Offline
 

Mysql> how to store select Zulu / UTC timestamp in database

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  
E-mail friendPrint 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 convert unix timestamp to human readable format

mandrei99

0

1673

Wed Jan 14, 2015 11:36 am

mandrei99 View the latest post

There are no new unread posts for this topic. How to calculate mysql time difference between unix timestamp column and now() format

mandrei99

0

4685

Fri May 31, 2013 4:10 am

mandrei99 View the latest 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

1800

Tue Nov 22, 2011 9:40 am

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

1204

Mon Feb 22, 2010 1:43 pm

debuser View the latest post

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

debuser

1

1794

Fri Oct 08, 2010 1:38 am

sonee4 View the latest post

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

debuser

1

590

Fri Oct 08, 2010 1:36 am

sonee4 View the latest post

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

admin

2

930

Mon Nov 28, 2011 3:39 am

Darwin View the latest post

There are no new unread posts for this topic. How to use a mysql stored procedure

debuser

1

595

Tue Nov 22, 2011 1:23 am

Darwin View the latest post

There are no new unread posts for this topic. Mysql: Cleaning binary logs

debuser

1

962

Tue May 18, 2010 9:45 am

designeru View the latest post

There are no new unread posts for this topic. Mysql change column's default value

debuser

0

1131

Thu Aug 12, 2010 3:43 am

debuser View the latest post

 

Who is online
Users browsing this forum: No registered users and 0 guests
You can post new topics in this forum
You can 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 - 5 hours [ DST ]



phpBB SEO