date format question

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

Post Reply
basher400
Forum Newbie
Posts: 5
Joined: Mon Mar 27, 2006 1:17 am

date format question

Post by basher400 »

Hi

I have this time stamp:
20051107065122

I'm trying to parse it into something like this:
Nov 07 2005, 06:51:22

I've tried the following:

Code: Select all

echo date("M d Y H:i:s", "20051107065122" );
echo gmdate("M d Y H:i:s", "20051107065122" ));
either of the above give me:
Jan 19 2038 03:14:07



what am I doing wrong?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it's not a unix timestamp, which is what PHP expects. You'll have to break it apart using substr()
Post Reply