The idea to use gmtime/timegm is a good one. Another simple idea is to go from noon of the source day. There is no daylight offset that will ever give you trouble if you go from noon.
perl -e 'use Time::Local qw(timelocal); print "".localtime(timelocal(0
+,0,12,23,1,2006)+86400*124)."\n"'
# prints Tue Jun 27 13:00:00 2006
Of course this all assumes that you aren't worried about the hours - but there are easy ways to handle those also. You just retain the hours,mins,secs from before the day conversion and replace the hours,mins,secs of the converted date.
my @a=qw(random brilliant braindead); print $a[rand(@a)];
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.