From: Nicholas Clark Date: Wed, 7 Apr 2004 20:48:04 +0000 (+0000) Subject: Make gmtime and localtime cross reference each other. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fe86afc2233e9cf24ad1235b7f1fbca2fba9ec98;p=p5sagit%2Fp5-mst-13.2.git Make gmtime and localtime cross reference each other. Suggested by Dan Jacobson p4raw-id: //depot/perl@22672 --- diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index b3927a2..61a5bb5 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -2151,22 +2151,13 @@ In scalar context, C returns the ctime(3) value: $now_string = gmtime; # e.g., "Thu Oct 13 04:54:34 1994" -Also see the C function provided by the C module, -and the strftime(3) function available via the POSIX module. +If you need local time instead of GMT use the L builtin. +See also the C function provided by the C module, +and the strftime(3) and mktime(3) functions available via the L module. -This scalar value is B locale dependent (see L), but -is instead a Perl builtin. Also see the C module, and the -strftime(3) and mktime(3) functions available via the POSIX module. To -get somewhat similar but locale dependent date strings, set up your -locale environment variables appropriately (please see L) -and try for example: - - use POSIX qw(strftime); - $now_string = strftime "%a %b %e %H:%M:%S %Y", gmtime; - -Note that the C<%a> and C<%b> escapes, which represent the short forms -of the day of the week and the month of the year, may not necessarily -be three characters wide in all locales. +This scalar value is B locale dependent (see L), but is +instead a Perl builtin. To get somewhat similar but locale dependent date +strings, see the example in L. =item goto LABEL @@ -2538,17 +2529,20 @@ In scalar context, C returns the ctime(3) value: $now_string = localtime; # e.g., "Thu Oct 13 04:54:34 1994" -This scalar value is B locale dependent, see L, but -instead a Perl builtin. Also see the C module -(to convert the second, minutes, hours, ... back to seconds since the -stroke of midnight the 1st of January 1970, the value returned by -time()), and the strftime(3) and mktime(3) functions available via the -POSIX module. To get somewhat similar but locale dependent date -strings, set up your locale environment variables appropriately -(please see L) and try for example: +This scalar value is B locale dependent but is a Perl builtin. For GMT +instead of local time use the L builtin. See also the +C module (to convert the second, minutes, hours, ... back to +the integer value returned by time()), and the L module's strftime(3) +and mktime(3) functions. + +To get somewhat similar but locale dependent date strings, set up your +locale environment variables appropriately (please see L) and +try for example: use POSIX qw(strftime); $now_string = strftime "%a %b %e %H:%M:%S %Y", localtime; + # or for GMT formatted appropriately for your locale: + $now_string = strftime "%a %b %e %H:%M:%S %Y", gmtime; Note that the C<%a> and C<%b>, the short forms of the day of the week and the month of the year, may not necessarily be three characters wide.