get timestamp in perl -


My date is 201103116

For tomorrow, I want to stamp the initial timestamp and end time .

The Pearl-Core method will be:

  My ($ Y, $ M, $ d) = Unpack 'A4A2A2', $ date; My $ start_ts = POSIX :: Mktime (0, 0, 0, $ d, $ m - 1, $ y - 1900); My $ end_ts = POSIX :: mktime (0, 0, $ d + 1, $ m - 1, $ y - 1900); With   

look

and mktime this is just fine by adding values ​​to negative so if you suggested the comment according to your last date , You can fix it with:

  my $ end_ts = POSIX :: mktime (- 1, 0, 0, $ d + 1, $ m - 1, $ Y - 1900);   

(However, I would just like to note that the excluded endpoint programming is not an unknown case.)

Comments