4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 MySQL TimeStamp
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
Iyonix
WebHelper
WebHelper


Joined: 12 Nov 2002
Posts: 82
Location: Yarm, England

PostPosted: Sat Jan 25, 2003 2:09 pm (14 years, 10 months ago) Reply with QuoteBack to Top

Hi, I want to get the current time as a mySQL timestamp from my database. What command should I use?

mysql> SELECT now();

only gives it in the wrong format Sad
e.g 2000-08-03 16:56:03

thanks,

________________________________
Iyonix
OfflineView User's ProfileFind all posts by IyonixSend Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Sat Jan 25, 2003 2:21 pm (14 years, 10 months ago) Reply with QuoteBack to Top

I'm just curious, why would you want to SELECT the current time from your database, as opposed to just getting it from PHP?

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Iyonix
WebHelper
WebHelper


Joined: 12 Nov 2002
Posts: 82
Location: Yarm, England

PostPosted: Sat Jan 25, 2003 2:23 pm (14 years, 10 months ago) Reply with QuoteBack to Top

Daniel wrote:
I'm just curious, why would you want to SELECT the current time from your database, as opposed to just getting it from PHP?


Because the time on the DB is different to that in PHP because they are on different servers.
I have just worked out a better way to do this so it doesn't matter now.

Thanks,

________________________________
Iyonix
OfflineView User's ProfileFind all posts by IyonixSend Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Sat Jan 25, 2003 2:27 pm (14 years, 10 months ago) Reply with QuoteBack to Top

For those interested, you could probably have used the DATE_FORMAT(NOW(),'FORMAT') function. For details, visit http://www.mysql.com/doc/en/Date_and_time_functions.html.

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




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 vote in polls in this forum.


Page generation time: 0.049871 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme