datetime convertion

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
kahwooi
Forum Commoner
Posts: 25
Joined: Fri Dec 10, 2004 12:28 am

datetime convertion

Post by kahwooi »

How to convert RFC 3399 '2006-09-21T08:10:00-08:00' to normal datetime 20006-09-21 08:10:00?

Thank you.
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

Did you try strtotime()?
kahwooi
Forum Commoner
Posts: 25
Joined: Fri Dec 10, 2004 12:28 am

Post by kahwooi »

Yah I did try, but wrong result.
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Re: datetime convertion

Post by n00b Saibot »

kahwooi wrote:to normal datetime 20006-09-21 08:10:00?
you call that normal? :lol:

what do you mean by wrong result?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

kahwooi wrote:Yah I did try, but wrong result.
What result did you get? And how are you getting that date in the first place?
kahwooi
Forum Commoner
Posts: 25
Joined: Fri Dec 10, 2004 12:28 am

Post by kahwooi »

$strtotime = strtotime('2006-09-21T08:10:00-08:00');
echo date('H:i:s', $strtotime);

I think I'm not right. Please Help!
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

If your date is definitely going to be in RFC 3399 format, just use a regular expression to break it down and then feed the elements into mktime(). I doubt strtotime() knows how to handle RFC 3399 format.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Can't find a rfc 3399 at http://www.rfc-editor.org/rfc-index.html
3398 Integrated Services Digital Network (ISDN) User Part (ISUP) to Session Initiation Protocol (SIP) Mapping G. Camarillo, A. B. Roach, J. Peterson, L. Ong [ December 2002 ] ( TXT = 166197 bytes)
3400 Not Issued [ ] ( TXT = 29 bytes)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

It's ISO 8601 format. See date().
Post Reply