blank.gif (43 bytes)

Church Of The
Swimming Elephant

Search:

gmtime function

Convert UNIX time into record or string using Greenwich time

    gmtime EXPR

Converts a time as returned by the time function to a 9-element array with the time localized for the standard Greenwich time zone. Typically used as follows:

    #  0    1    2     3     4    5     6     7     8
    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
                                            gmtime(time);

All array elements are numeric, and come straight out of a struct tm. In particular this means that $mon has the range 0..11 and $wday has the range 0..6 with sunday as day 0. Also, $year is the number of years since 1900, that is, $year is 123 in year 2023, not simply the last two digits of the year.

If EXPR is omitted, does gmtime(time()).

In scalar context, returns the ctime(3) value:

    $now_string = gmtime;  # e.g., "Thu Oct 13 04:54:34 1994"

Also see the timegm() function provided by the Time::Local module, and the strftime(3) function available via the POSIX module.

This scalar value is not locale dependent, see the perllocale manpage, but instead a Perl builtin. Also see the Time::Local module, and the strftime(3) and mktime(3) function available via the POSIX module. To get somewhat similar but locale dependent date strings, set up your locale environment variables appropriately (please see the perllocale manpage) and try for example:

    use POSIX qw(strftime);
        $now_string = strftime "%a %b %e %H:%M:%S %Y", gmtime;

Note that the %a and %b, the short forms of the day of the week and the month of the year, may not necessarily be three characters wide.

Cotse.Net

Protect yourself from cyberstalkers, identity thieves, and those who would snoop on you.
Stop spam from invading your inbox without losing the mail you want. We give you more control over your e-mail than any other service.
Block popups, ads, and malicious scripts while you surf the net through our anonymous proxies.
Participate in Usenet, host your web files, easily send anonymous messages, and more, much more.
All private, all encrypted, all secure, all in an easy to use service, and all for only $5.95 a month!

Service Details

 
.
www.cotse.com
Have you gone to church today?
.
All pages ©1999, 2000, 2001, 2002, 2003 Church of the Swimming Elephant unless otherwise stated
Church of the Swimming Elephant©1999, 2000, 2001, 2002, 2003 Cotse.com.
Cotse.com is a wholly owned subsidiary of Packetderm, LLC.

Packetderm, LLC
210 Park Ave #308
Worcester, MA 01609