PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
dream2rule
Forum Contributor
Posts: 109 Joined: Wed Jun 13, 2007 5:07 am
Post
by dream2rule » Sat Jun 30, 2007 5:11 am
I have a date field in the form in the format YYYY-MM-DD (1991-01-01)
I want to convert this date field in the Format of (F j Y) ==> Jan 01 1991
but when i try to do the above its converting the current system date but not taking the date which has been entered using the form.
What might be the issue?
Regards,
Dream2rule
Weirdan
Moderator
Posts: 5978 Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine
Post
by Weirdan » Sat Jun 30, 2007 5:31 am
post your code
dream2rule
Forum Contributor
Posts: 109 Joined: Wed Jun 13, 2007 5:07 am
Post
by dream2rule » Sat Jun 30, 2007 5:36 am
Code: Select all
$str = '01-01-1991';
$timestamp = strtotime($str);
$date = date('F j Y', $timestamp);
Got the solution thanks...!
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sat Jun 30, 2007 7:18 am
If this information is coming from a database, which it appears to be, use the database's date functions to convert it.