Page 1 of 1

Converting Date to another form

Posted: Sat Jun 30, 2007 5:11 am
by dream2rule
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
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2.1. When asking a question, be as specific as you can be, provide the relevant code and any other information that is helpful in a concise and coherent manner. If you are not sure how to do that, read these guidelines.

Posted: Sat Jun 30, 2007 5:31 am
by Weirdan
post your code

Posted: Sat Jun 30, 2007 5:36 am
by dream2rule

Code: Select all

$str = '01-01-1991';

$timestamp = strtotime($str);

$date = date('F j Y', $timestamp);
Got the solution thanks...!

Posted: Sat Jun 30, 2007 7:18 am
by feyd
If this information is coming from a database, which it appears to be, use the database's date functions to convert it.