in reply to Re: POSIX::mktime() or Time::Local::timelocal()
in thread POSIX::mktime() or Time::Local::timelocal()

Please note that timelocal() range-checks its parameters, and cannot be used to 'normalise' a date which mktime() can do.

For example, mktime() can be passed the month=14. This means March in the following year.

I.e., 11=Dec, 12=Jan next year, 13=Feb next year, 14=Mar next year.

Another example is you have today's date, then you can add 18 to months to get the epoch-seconds for the year, month & day in 18 month's time.

Negative values can also be used, for example, -1 for the day, which is effectively the last day of the previous month.

  • Comment on Re^2: POSIX::mktime() or Time::Local::timelocal()