Re: FormatDateTime Revisited
- From: "Adam Plocher" <aplocher@xxxxxxxxx>
- Date: 17 Jan 2006 11:25:40 -0800
PHP has some great date functions for formatting dates however you
could possibly want. First take a look at www.php.net/date for a list
of formats.
Notice that the second (optional) parameter to the date function is a
timestamp parameter. You must convert your date/time into a unix
timestamp but this can easily be achieved with the strtotime() function
(www.php.net/strtotime).
So basically you would want to do:
echo date("Y-m-d H:i:s", strtotime("December 25, 2005 11:55 PM"));
// this should return 2005-12-25 23:55:00 - this is the format I
usually use when inserting into MySQL
Note that strtotime should be able to take in just about ANY format of
date and time.
.
- Follow-Ups:
- Re: FormatDateTime Revisited
- From: John K
- Re: FormatDateTime Revisited
- References:
- FormatDateTime Revisited
- From: John K
- FormatDateTime Revisited
- Prev by Date: Re: adding more fields to a form
- Next by Date: Re: Defining a callback Func for preg_replace_callback(), within some class's method
- Previous by thread: FormatDateTime Revisited
- Next by thread: Re: FormatDateTime Revisited
- Index(es):
Relevant Pages
|