Print Yesterday’s Date Using Perl
by lokety on Dec.22, 2006, under Posts
Quick tip for working with Unix scripts that need yesterday’s date. If you have Perl, try this:
should print to stdout the date in the yyyymmdd format. Much simpler than writing an entire function in a script and messing around with 1st of the month, leap years, and possibly dates beyond 2037 (check Perl documentation).
Links:
The UNIX Forums – get yesterday in yyyymmdd format
<URL:http://www.unix.com/showthread.php?t=20181>
Technorati Tags: unix, programming, script, perl, yesterday’s date
Related posts:
- Print Unix File Timestamp Accurate Down to Seconds
- Blogger.com Template Tip: Render Previous Post Link At Bottom Of Main Page
- Blogger.com Template Tip Part 2: Render Previous Post Links

February 7th, 2007 on 00:11
Thanks for this! :) It works for me!
August 7th, 2007 on 03:29
Good to know that. I have a few more perl scripts that I’d love to share. They help to do disk space housekeeping and performance tracking on bash and sh.