From: Gurusamy Sarathy Date: Thu, 16 Dec 1999 09:32:48 +0000 (+0000) Subject: spell out how to get 4-digit year (from Micheal G Schwern X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=abd75f244b222c1ed3bdddd03baac15292b665b4;p=p5sagit%2Fp5-mst-13.2.git spell out how to get 4-digit year (from Micheal G Schwern ) p4raw-id: //depot/perl@4684 --- diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 9ee2b5f..e5652ef 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -1884,6 +1884,14 @@ I simply the last two digits of the year. If you assume it is, then you create non-Y2K-compliant programs--and you wouldn't want to do that, would you? +The proper way to get a complete 4-digit year is simply: + + $year += 1900; + +And to get the last two digits of the year (e.g., '01' in 2001) do: + + $year = sprintf("%02d", $year % 100); + If EXPR is omitted, does C. In scalar context, returns the ctime(3) value: @@ -2239,6 +2247,14 @@ and I simply the last two digits of the year. If you assume it is, then you create non-Y2K-compliant programs--and you wouldn't want to do that, would you? +The proper way to get a complete 4-digit year is simply: + + $year += 1900; + +And to get the last two digits of the year (e.g., '01' in 2001) do: + + $year = sprintf("%02d", $year % 100); + If EXPR is omitted, uses the current time (C). In scalar context, returns the ctime(3) value: