Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for tomorrow.pl

(view source code of tomorrow.pl as plain text)

  1. #! perl
  2.  
  3. # Tomorrow.pl,  Version 1.00
  4. # Display tomorrow's "sorted" date (YYYYMMDD)
  5. # Written by Rob van der Woude
  6. # http://www.robvanderwoude.com
  7.  
  8. # Specify function library
  9. use Time::Local;
  10.  
  11. # Convert today to epoch seconds
  12. $today = timelocal(localtime);
  13.  
  14. # Add 1 day
  15. @tomorrow = localtime($today + (24 * 60 * 60));
  16.  
  17. # Extract year, month and day, and correct base offsets
  18. $year  = (@tomorrow)[5] + 1900;
  19. $month = (@tomorrow)[4] + 1;
  20. $day   = (@tomorrow)[3];
  21.  
  22. # Display the result, correctly formated
  23. printf("\nTomorrow = %04d%02d%02d\n", $year, $month, $day);
  24.  

page last modified: 2024-04-16; loaded in 0.0137 seconds