How much trouble would it be to move to a different server (which would be more up-to-date and/or maintained better)? (:P) -- I mean, really, Perl 4.x? WHY??

Anyway, could you giva a little more detail? What is the original form of the two dates being compared? (Seconds since the epoch? "Mnth Dy Year HH:MI:SS"? Something else?) I don't recall now whether Perl 4 has both the "localtime" and the "timelocal" functions -- if so, you might be able to work with those.

update: OK, having seen your reply, one more question... (warning: heading for Klugeville here): I gather you don't need accuracy to the hour, minute or second -- you just need to count the days between two given dates. So, what sort of time-depth do you have to deal with? Any dates before 1900? Before 1970?

If there is a definite threshold date, such that no computation will involve a date before that, you could establish that date as the start of your own "epoch". Then, you could use a modern version of perl on some other system (or use any tool of your choice) to create a look-up table of months and years: for each month/year, the table gives the number of days from the beginning of your epoch to the beginning of the month. Format this table in such a way that your Perl 4.x script can "require date_lookup.tbl", or simply read the table data into an array a hash.

Given such a table, you can easily take any two date strings convert them to "number of days since start of the epoch" (use month/year to get the table index and add the day-of-month to that), and then just subtract to get the number of days between them.


In reply to Re: Need Advice: Date difference revisted by graff
in thread Need Advice: Date difference revisted by emilford

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.