Posted by DXTrim on 02/14/06 18:10
You could try this:
$t2 = date('M d, Y g:i', stringtotime($t));
I have not tested if your format is correct.
Hope this helps.
"Eli" <email@example.com> wrote in message
> I have time stored as the following: YYYY-MM-DD HH:MM:SS, so it gives
> something like 2006-01-26 01:40:14. I'm trying to get the format to be
> 26, 2006 1:40. I try something like this:
> $t2 = date('M d, Y g:i', $t);
> But it gives the wrong date, so I must be doing something wrong. I've
> all over for date formatting but they only seem to be able to format the
> date and then insert it into the database, but my database already has
> in this format and I'd prefer not to change the way the dates are stored.
> Can you help explain the proper way to format a date?
> I also attempted to store the date/time as a timestamp but was never
> successful at acheiving that. I produced the timestamp (lots of numbers),
> but when I tried to put it into the database, it seemed to reject it and I
> ended up with 0000-00...etc.
> - Eli
[Back to original message]