View Full Version : Storing format of date and time
09-29-2007, 03:42 AM
Hey guys! How can I store the following format of date and time in database?
Date=Mon 01th Oct
09-29-2007, 03:51 AM
Don't. Store timestamps, then convert later, using date($format,$stamp);
Much more versatile and easier to store as well.
09-29-2007, 03:58 AM
Is it look like that?
`reserve_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`reserve_time` timestamp NOT NULL default '0000-00-00 00:00:00',
How can I convert them to desired format using PHP?
09-29-2007, 04:30 AM
Go to php.net. Type "date" in the search field. See formats. Easy.
You'll be storing a timestamp value into the database, which will be the number of seconds since 1970. It's 1100000000 something right now, or so. use time() to get that. There's also a keyword in mysql, I believe %date% or something, but I forget the details. Look that up.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.