Today I was working on a script, and one of the subroutines needed simple seconds-based arithmetics with time. As you probably remember from my date and time in Unix scripts article, the easiest way to approach this task is to deal with the raw representation of date and time in Unix – the Unix epoch times. This post will show you how to convert standard dates into Unix epoch times in Perl.
If you have followed this blog for a while, you should remember how to use variables in Unix shell scripts.
Going further, I'd like to show you some basics of working with time and date in your scripts – generating all sorts of timestamps and timing some parts of your script for reporting purposes.