iGuest 3 Report post Posted November 22, 2004 Does anybody here knows how to make the date in my script from 01-10-2004 to January 10, 2004. My script displays the date in this format and I want to make it like the latter but I don't know how. The script uses a database. Just wanna ask if what type should be the date in the db?I know how to make it January 10, 2004. It's like date("m i, Y")Hope somebody'll reply! Share this post Link to post Share on other sites
iGuest 3 Report post Posted November 22, 2004 i remember when i didnt know this - i made this hugely complicated 'if then' script....then found that it was easy enough.Probably best to just stick 'php time' into google - though i might copy it across for you later.There are 2 different formats....UNIXTIME - which is the number of seconds from the epoch (1st of Jan 1970) (if anyone wants to convert this to number of years / weeks / days/ hours /minutes / seconds ...then i made another script to do it...cos i dont know that much about strings, if someone wants to explain that would be cool)Or there is the date format....generally you get the unix format with the now() command, and get the date format with another one.... its all on google, i havnt remembered it - i just copy it from where i have it when i need it or look it up. Share this post Link to post Share on other sites
iGuest 3 Report post Posted November 22, 2004 Hmm... I'm not sure if I understand your problem correctly, but maybe you need this: $time= ... // get the date from database$time=strtotime($time); // converts mysql date format ("2004-11-20") into UNIX type time variable (number of sec. since 1/1/1970)$date=date("m i, Y", $time); // the date() function takes as an optional second parameter an UNIX type time variable Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 11, 2005 Looks like it's closer to my problem. But where should I place this code? In my config.php? Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 14, 2005 i store my data in the db in datetime format.using $time = now();and inserting it with..FROM_UNIXTIME('$time')in the sql command. Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 15, 2005 thank you! Share this post Link to post Share on other sites