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
myleow
Forum Contributor
Posts: 194 Joined: Mon Jun 21, 2004 7:05 pm
Location: California
Post
by myleow » Tue Aug 17, 2004 5:29 pm
Is there a way to get the current timestamp without using
? I am not using PHP5.
I am using PHP 4.1.2 so if there is a way please provide me with the example to do so.
Regards
Mian
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Aug 17, 2004 5:42 pm
Code: Select all
<?php
function getISO8601($time = false)
{
if(!is_int($time))
$time = time();
$offset = date('O',$time);
$len = strlen($offset);
$offset .= $offset{$len-1};
$offset{$len-1} = $offset{$len-2};
$offset{$len-2} = ':';
return date('Y-m-d\TH:i:s',$time) . $offset;
}
echo getISO8601();
?>outputs
for my local machine
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Wed Aug 18, 2004 9:40 am
[php_man]time[/php_man]()
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.