Page 1 of 1

Is there a way to get the current timestamp

Posted: Tue Aug 17, 2004 5:29 pm
by myleow
Is there a way to get the current timestamp without using

Code: Select all

$current_timestamp = date('c');
? 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

Posted: Tue Aug 17, 2004 5:42 pm
by feyd

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

Code: Select all

2004-08-17T15:42:23-07:00
for my local machine :)

Posted: Wed Aug 18, 2004 9:40 am
by pickle
[php_man]time[/php_man]()

Code: Select all

$curr_time = time();