This is a discussion on "[SOLVED] convert date format" within the PHP Forum section. This forum, and the thread "[SOLVED] convert date format are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
[SOLVED] convert date format
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
||||
|
||||
|
[SOLVED] convert date format
i need To convert between my 06th November 2007 format and the YYYY-MM-DD format when inserting them into the database from a form and retreiving them from the database...
could someone give me a hand with this one, thanks
Last Blog Entry: Strict and Transitional Doctype's (Sep 12th, 2008)
|
|
|
|
#2
|
||||
|
||||
|
Re: convert date format
You could use the strtotime and strftime functions like this:
Hope that helps, Cheers.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#3
|
||||
|
||||
|
Re: convert date format
i have this ( form process )
blog1 blog2 blog3 i need it to be latest first blog3 blog2 blog1 from what i understand it is the time that is the problem, because
but i do need the form itself the display this format
Last Blog Entry: Strict and Transitional Doctype's (Sep 12th, 2008)
Last edited by saltedm8; Oct 6th, 2007 at 08:43. |
|
#4
|
||||
|
||||
|
Re: convert date format
Okay, I find that for something as simple as a blog, it is best to have that column as an integer and add a unix timestamp to it. This allows for ease of sorting ASC DESC when pulling from the database.
If the column is set as a mySQL datestamp, it will also word the same way because of the way the date is formatted YYYY-MM-DD. I assume the way you now have it is that the column has a value of something like 6th November 2006 etc?
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#5
|
||||
|
||||
|
Re: convert date format
( install script )
Last Blog Entry: Strict and Transitional Doctype's (Sep 12th, 2008)
Last edited by saltedm8; Oct 6th, 2007 at 08:53. |
|
#6
|
||||
|
||||
|
Re: convert date format
Okay, you could change this
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#7
|
||||
|
||||
|
Re: convert date format
that worked, thank you - i have been up most of the night trying to deal with that one, the only problem now is the date once submitted to the blog is displaying like
Quote:
Last Blog Entry: Strict and Transitional Doctype's (Sep 12th, 2008)
|
|
#8
|
||||
|
||||
|
Re: convert date format
No problems
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| convert dates in Unix time format | ktsirig | PHP Forum | 1 | Feb 11th, 2007 14:01 |
| Convert date to MySQl format | AdRock | PHP Forum | 4 | Jan 15th, 2007 09:41 |
| Changing date format in date picker | AdRock | JavaScript Forum | 1 | Aug 1st, 2006 17:16 |
| convert string to datetime format ... | jeffmarsh | Other Programming Languages | 0 | Jul 2nd, 2006 06:36 |
| date format help please | charter | Databases | 3 | Jun 14th, 2004 20:09 |