homepage Welcome to WebmasterWorld Guest from 54.234.0.85
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
converting REQUEST TIME number to English
n00b alert
oddsod

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3765986 posted 10:55 am on Oct 15, 2008 (gmt 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

 

Slade

10+ Year Member



 
Msg#: 3765986 posted 11:43 am on Oct 15, 2008 (gmt 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.

oddsod

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3765986 posted 12:15 pm on Oct 15, 2008 (gmt 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.

coopster

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



 
Msg#: 3765986 posted 12:33 pm on Oct 15, 2008 (gmt 0)

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

Anyango

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3765986 posted 12:34 pm on Oct 15, 2008 (gmt 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]

oddsod

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3765986 posted 12:37 pm on Oct 15, 2008 (gmt 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]

coopster

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



 
Msg#: 3765986 posted 12:38 pm on Oct 15, 2008 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved