A Digital Age Deserves A Digital Leader

need help with mysql timestamp :dontgetit

need help with mysql timestamp :dontgetit

Postby Leychay » Fri Dec 07, 2007 1:36 am

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 ^*^
Image
PRO New Member
Posts: 7
Joined: Mon Mar 27, 2006 3:22 am
Location: Malaysia

Postby NT50 » Fri Dec 07, 2007 12:49 pm

Be patient and somebody should be by soon to help you with this.
Dogs Have Owners; Cats Have Staff
PROfessional Member
User avatar
Posts: 8220
Joined: Sat Jun 19, 2004 4:46 pm
Location: Jackson, TN USA
Real Name: Jeff Replogle

Postby Leychay » Tue Dec 11, 2007 1:21 am

ok NT50~

thanks for the encouragement~

appreciate dat

;)
Image
PRO New Member
Posts: 7
Joined: Mon Mar 27, 2006 3:22 am
Location: Malaysia

Postby NoReflex » Tue Dec 11, 2007 9:13 pm

I think you might find some help here :
http://www.w3schools.com/php/php_ref_date.asp
Good luck!

Best wishes,
Ionut
PRO Level 10
User avatar
Posts: 431
Joined: Wed Nov 17, 2004 8:41 pm
Location: Romania

Postby Leychay » Thu Dec 13, 2007 1:58 am

thanks NoReflex~

i'll try and check it out!~~


i've checked the page u gave to me, but i still cant find the right function to use it...

i think myb the function need to be execute using mysql query or something like dat~~

mybe someone can help me more?

i really appreciate ur help!~
;)
Image
PRO New Member
Posts: 7
Joined: Mon Mar 27, 2006 3:22 am
Location: Malaysia

Postby NoReflex » Thu Dec 13, 2007 11:09 am

If you want to use sql to do this you could use the time() function for extracting the time part:
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
PRO Level 10
User avatar
Posts: 431
Joined: Wed Nov 17, 2004 8:41 pm
Location: Romania

Postby Leychay » Tue Dec 18, 2007 2:37 am

a million thanks to u NoReflex~~

i've got it now~~

now i just want to try to explore more about its function~~

thanks again~!

;)
Image
PRO New Member
Posts: 7
Joined: Mon Mar 27, 2006 3:22 am
Location: Malaysia

Return to HTML, CSS, and Scripts

Who is online

Users browsing this forum: No registered users and 2 guests