Dates and Times in Perl
Tutorials Shared by the Internet Community
Total Hits - 27825
Total Votes - 115 votes
Vote Up - 50 votes
Vote Down - 65 votes
Domain - blog.codebeach.com
Category - Perl & CGI/Getting Started
Submitted By - Devesh Khanna
Submitted on - 2008-03-16 00:59:39
There are two ways of measuring time: ages from today, and counting from an arbitrary date in the past. So, for example, you can get that a file is 28.5 days old, or you can find out that the file was created at 3:53 PM on January 21, 1985. In Perl, you measure the latter in seconds from “the start of the epoch”.
The epoch is simply the earliest date your computer can use. For most Unix computers, this is the midnight before January 1, 1970, universal standard time. On the Macintosh, this is the midnight before January 1, 1904. You don’t really need to worry about that, since you’ll generally be feeding the number of seconds into special built-in functions that take the seconds and return information about that date that number represents. ...