View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Michael G Schwern > uny2k > uny2k



Annotate this POD

View/Report Bugs
Module Version: 19.1080828   Source  


uny2k - Removes y2k fixes


  use uny2k;

  $year = (localtime)[5];
  printf "In the year %d, computers will everything for us!\n", 
      $year += 1900;


Y2K has come and gone and none of the predictions of Doom and Gloom came to past. As the crisis is over, you're probably wondering why you went through all that trouble to make sure your programs are "Y2K compliant". is a simple module to remove the now unnecessary y2k fixes from your code.

Y2K was a special case of date handling, and we all know that special cases make programs more complicated and slower. Also, most Y2K fixes will fail around 2070 or 2090 (depending on how careful you were when writing the fix) so in order to avert a future crisis it would be best to remove the broken "fix" now.

uny2k will remove the most common y2k fixes in Perl:

    $full_year = $year + 1900;

    $two_digit_year = $year % 100;

It will change them back to their proper post-y2k values, 19100 and 100 respectively.


Michael G Schwern <> with apologies to Mark "I am not ominous" Dominus for further abuse of his code.


Copyright 2001-2008 Michael G Schwern <>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself (though why you would want to is beyond me).


SEE ALSO ^, D'oh::Year, a good therapist

syntax highlighting: