Jump to content

Archived

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

Ninjakreborn

code help

Recommended Posts

<?php
print time();
$foo = time();
print $foo;
?>
umm why did this give me
11454150731145415073
that updates every time I hit refresh, is there a better way to do this, htis may be the time, but I don't understand this language of time, I am use to 10:30, 12:20 or so so, military time, gmt +- theories, What is this number here for that autoupdated everytime I hit the refresh button.

Share this post


Link to post
Share on other sites
Then I get the output of
1145415854
this is confusing. In javascript you just throw down a few variables ina function, and you can get the time, is it better doing this with javascript. Or is it really complicated with php.

Share this post


Link to post
Share on other sites
That's the current Unix timestamp. You want to use the date() function to format the date like this:

[code]<?php

$timestamp = time();
$formatted = date("g:h:i", $timestamp);
echo $formatted;

?>[/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.