Jump to content

Archived

This topic is now archived and is closed to further replies.

tecdesign

timestamp

Recommended Posts

how do I turn a time stamp when posted looks like this 20060426152138 into something readable like
26th 04 2006 15:21pm or something that looks good.

Share this post


Link to post
Share on other sites
[code]echo date("l jS \of F Y h:i:s A", $timestamp);[/code]Check the date() page in the manual for more information on how to format it.

Share this post


Link to post
Share on other sites
[!--quoteo(post=368761:date=Apr 25 2006, 08:30 PM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ Apr 25 2006, 08:30 PM) [snapback]368761[/snapback][/div][div class=\'quotemain\'][!--quotec--]
[code]echo date("l jS \of F Y h:i:s A", $timestamp);[/code]Check the date() page in the manual for more information on how to format it.
[/quote]

In my database it reads this 20060427062251 which is right but in website it is posting 19 01 38 which is d m y which in long form it goes to tuesday 19th of january 2038? Does anyone know what could be causing this?

Share this post


Link to post
Share on other sites
I think we got our wires crossed on the whole timestamp thing - I just glanced at your timestamp and assumed it was a *NIX timestamp. Upon looking at it in more detail it looks like its just the year, month, date, hour, minute and second all in one string... In which case you can just chop it up with substr() I guess, unless theres a function that does this for you, I cant think of one off the top of the head.
[code]<?php
$str = "20060426152138";
$year = substr($str,0,4);
$month = substr($str,4,2);
$day = substr($str,6,2);
$hour = substr($str,8,2);
$minute = substr($str,10,2);
$second = substr($str,12,2);
?>[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.