Welcome to WebmasterWorld Guest from 54.205.0.26

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

converting REQUEST TIME number to English

n00b alert

     
10:55 am on Oct 15, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 21, 2005
posts:2259
votes: 0


A n00b question if you'd indulge me, please.

I have REQUEST_TIME: 1223128964 (for example). I appreciate the counting in seconds from 1970 etc but I've never had reason to convert those numbers to a normal dates/times. Is there a utility anywhere that does this? I have several numbers I wish to convert.

TIA

11:43 am on Oct 15, 2008 (gmt 0)

Preferred Member

10+ Year Member

joined:July 16, 2001
posts:545
votes: 0


[us.php.net...]

Returns a string formatted according to the given format string using the given integer timestamp or the current time if no timestamp is given.
12:15 pm on Oct 15, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 21, 2005
posts:2259
votes: 0


Thanks, Slade. I found that site earlier via Google. That quote is from their description of REQUEST_TIME. The page gives me a lot of technical info, parameters etc but - maybe I'm missing something obvious - there seems no info on easily converting 1223128964 to a human recognisable form.

I'm not looking to setup some conversion on my site. I just want to convert a bunch of numbers I have in a text file.

12:33 pm on Oct 15, 2008 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12541
votes: 1


The examples on that page show you how to use the command. For example:
$time = 1223128964; 
print date('l, F j, Y g:i a', $time); // Saturday, October 4, 2008 2:02 pm
12:34 pm on Oct 15, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 24, 2005
posts:697
votes: 0


<?
echo date("d-m-y",1223128964);
?>

that ? or maybe i misunderstood, sorry if thats the case.

Oops, Coopster got it a few seconds faster :)

[edited by: Anyango at 12:36 pm (utc) on Oct. 15, 2008]

12:37 pm on Oct 15, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 21, 2005
posts:2259
votes: 0


So I have to create a php file and put that code in? And keep changing the number in the code to convert each of them?

I was hoping there would be some online utility somewhere - like the binary to hex converters - where I could type in each number and see what the associated date was.

<added> Not to worry, I've tried creating the php file and it works so I'll do it that way. Thanks for all your help.

[edited by: oddsod at 12:39 pm (utc) on Oct. 15, 2008]

12:38 pm on Oct 15, 2008 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12541
votes: 1


Yes, you could use a PHP script to process your text file. You could use the filesystem functions to open the text file and read through your timestamps and then print them out or write them out to a new file.