need help with mysql timestamp :dontgetit
7 posts
• Page 1 of 1
need help with mysql timestamp :dontgetit
hye~
i'm a noob in using mysql and php..i'm doing some simple system which required me to record the time and date using timestamp function.
the problem is, i want to extract the date and time recorded into two section (different column for each date and time)..
to make it simpler, as we all know, timestamp recorded data such as--> (0000-00-00 00:00:00) right?
sample data: (1990-02-25 05:12:36)
which this data in column log_info in user table.
what i want to do is, i want to extract from that data and convert it into two column which is date and time column from the column log_info.
does anyone know how to solve this?
i really need your help right now~
thanks for concerning
I think you might find some help here :
http://www.w3schools.com/php/php_ref_date.asp
Good luck!
Best wishes,
Ionut
http://www.w3schools.com/php/php_ref_date.asp
Good luck!
Best wishes,
Ionut
If you want to use sql to do this you could use the time() function for extracting the time part:
and date() function to extract the date :
You can find the complete reference for date and time sql functions here :
http://dev.mysql.com/doc/refman/5.0/en/ ... tions.html
I hope this helps you. Good luck!
Best wishes,
John
- Code: Select all
mysql> SELECT TIME('2003-12-31 01:02:03');
-> '01:02:03'
mysql> SELECT TIME('2003-12-31 01:02:03.000123');
-> '01:02:03.000123'
and date() function to extract the date :
- Code: Select all
mysql> SELECT DATE('2003-12-31 01:02:03');
-> '2003-12-31'
You can find the complete reference for date and time sql functions here :
http://dev.mysql.com/doc/refman/5.0/en/ ... tions.html
I hope this helps you. Good luck!
Best wishes,
John
7 posts
• Page 1 of 1
Return to HTML, CSS, and Scripts
Who is online
Users browsing this forum: No registered users and 8 guests