I set up a variable for date that I use to post data in mysql table.
$todaysdt = date('Y-m-d',time());
I would like retrieve the date for display in this format: m-d-yyyy, so I tried date('m-d-Y',$loggeddt), but I get weird results. For instance 2009-10/06 comes back as 12-31-1969. Is there a way I can convert the format of my date?
date('Y-m-d')????
Moderator: General Moderators
- edawson003
- Forum Contributor
- Posts: 133
- Joined: Thu Aug 20, 2009 6:34 am
- Location: Los Angeles, CA - USA
Re: date('Y-m-d')????
date() requires the second parameter to be a Unix Timestamp, you can use strtotime() to try and convert your formatted time into a Unix Timestamp.
- edawson003
- Forum Contributor
- Posts: 133
- Joined: Thu Aug 20, 2009 6:34 am
- Location: Los Angeles, CA - USA
Re: date('Y-m-d')????
Thanks, that worked. I implemented date('m-d-Y',strtotime($todaysdt));