Berkeley CSUA MOTD:Entry 27671
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/28 [General] UID:1000 Activity:popular
5/28    

2003/3/12-13 [Computer/SW/Languages/Perl] UID:27671 Activity:low
3/11    In unix what function/lib can I use to translate from a date to an
        integer value (given month/day/year, it returns a value), and
        vice versa? Thanks...
        \_ how about using a search engine? why wait several hours
           for an answer on the motd? i mean even "man -k time" would
           have given you the answer. you loser troll.
        \_ mktime and localtime, respectively.  You might also have a look
           at strftime and strptime, which convert between the integer value
           and human-readable strings.
        \_ Could you clarify what you are using?  Are you writing a C program?
           a perl script?  An sh script?
        \_ You could probably do this using strptime and then futzing around
           with the tm ptr.
        \_ perl
        \_ If you don't care what the integers are, you could concatenate
           the year, month, and day into something like "20030312". Use
           positional string operators to create and extract. You'll have
           Y10K problems if you stick with a 4-digit year. It's not an
           int, but neither are the numbers used in mktime(), etc.