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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |