Gerryjun, as the others have stated, you need to use
localtime. The function localtime is usually called like so:
($secs,$mins,$hrs,$dom,$moy,$yrs,$dow,$juldays,$dst) = localtime $reft
+ime;
$secs: seconds
$mins: minutes
$hrs: hours (military 24hr)
$dom: day of month
$moy: month of year (values 0-11, 0=jan)
$yrs: years since 1900
$dow: day of week (values 0-6, 0=sun)
$juldays: number of days since jan 1, current year
$dst: using daylight savings time (0=no, 1=yes)
The function time() returns the number of seconds since Jan 1, 1970.
BTW, the $refdate you gave (102049345) is for Monday, March 26, 1973.
$secs: 25
$mins: 2
$hrs: 21
$dom: 26
$moy: 2
$yrs: 73
$dow: 1
$juldays: 84
$dst: 0
If you start out with a reference date like the value
returned by time (your example: 102049345) and you say:
$wklater = $reftime + 60*60*24*6
$wklater can then be passed to localtime and you can build
the text string you want:
($secs,$mins,$hrs,$dom,$moy,$yrs,$dow,$juldays,$dst) = localtime $wkla
+ter;
Hint: Build a few array constants to return the string
parts (
$dow[1]="Monday", $moy[11]="December").
--Jim
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.