Author:
erics, July 8th, 2020
|
use POSIX qw(strftime); my $stamp = strftime "%Y%m%d%H%M%S", localtime; my $stamp = strftime "%Y%m%d%H%M%S", gmtime; |
Categories: How-To's, Technology Tags: Date, datetime, gmtime, howto, localtime, perl, Stamp, strftime, time, timedate, Timestamp, tips
| No comments
Author:
erics, June 29th, 2011
This simple formula will give a Y2K-compliant 4-digit year with low overhead:
|
$year = (localtime)[5] + 1900; |
Categories: How-To's, Technology Tags: howto, localtime, perl, tips, Y2K, Year
| No comments
Author:
erics, May 28th, 2011
|
use Date::Manip; my @months = qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/; my $month = $months[ (localtime)[4] ]; my $last = &UnixDate("last saturday in $month", "%B %e"); $last .= &gensuffix($last); sub gensuffix { my($val) = @_; my $end_num = substr($val, -1, 1); my $suffix = 'th'; $suffix = 'st' if $end_num == 1; $suffix = 'nd' if $end_num == 2; $suffix = 'rd' if $end_num == 3; return $suffix; } |
Categories: How-To's, Technology Tags: Date, Date::Manip, localtime, perl, Suffix, UnixDate
| No comments