[boulder.pm] date --> unix timestamp

rise rise at knavery.net
Fri Oct 26 14:07:53 CDT 2001


On Fri, 26 Oct 2001, Myke Komarnitsky wrote:

> I can't seem to figure out this one....
>
> $day = "01";
> $month = "10";
> $year = "2001";
> $hour = "2000";
> $unix_timestamp = &mystery_function("$day","$month","$year","$hour");
>
> is there some function out there to do this?  it's easy to go the opposite
> direction, but I haven't been able to figure out how to go this way.

$unix_timestamp = timelocal($sec, $min, $hours, $mday, $mon, $year);
or
$unix_timestamp = timegm($sec, $min, $hours, $mday, $mon, $year);

The mnemonic is that the names are the reverse of localtime() and
gmtime()...

-- 
Jonathan Conway 	   "Reverse Polish LISP" - for those times Forth
rise at knavery.net            just isn't on enough crack.





More information about the Boulder-pm mailing list