Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: How to calculate if today is before May 1

by shmem (Chancellor)
on Dec 29, 2019 at 17:05 UTC ( #11110730=note: print w/replies, xml ) Need Help??

in reply to How to calculate if today is before May 1

For "today":

shmem [qwurx] ~> perl -MDate::Parse -E 'say+(str2time("$_-05-01") >= t +ime ? "before" : "after"). " $_-05-01" for qw(2019 2020)' after 2019-05-01 before 2020-05-01 shmem [qwurx] ~>

Invoking that on 2020-05-01 will give you "after 2020-05-01". For distinguishig "before", "at" and "after" a simple ternary '? :' construct isn't enough.

For TODAY as a date in any year, just construct the input for st2time() and the TODAY epoch timestamp (use that instead of time above) according to the format of TODAY.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11110730]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2020-05-30 12:00 GMT
Find Nodes?
    Voting Booth?
    If programming languages were movie genres, Perl would be:

    Results (171 votes). Check out past polls.