Home: Perl Programming Help: Beginner:
Y2k date troubles



muinatit
Deleted

Feb 20, 2001, 3:42 PM


Views: 787
Y2k date troubles

I'm making a small utility script that returns the date. But the server year is 101. How would I go about changing the year from it's current format into legible format like 2001?

Jeffrey "muinatit" Lamoureux
muinatit@hotpop.com


wickedxter
User

Feb 20, 2001, 5:06 PM


Views: 785
Re: Y2k date troubles

use this
$year = ($year - 100) + 2000;



muinatit
Deleted

Feb 20, 2001, 5:48 PM


Views: 783
Re: Y2k date troubles

Thanks! I don't know why I didn't think of that earlier. :p

Jeffrey "muinatit" Lamoureux
muinatit@hotpop.com


Jasmine
Administrator / Moderator

Feb 21, 2001, 1:38 AM


Views: 782
Re: Y2k date troubles

Just an elaboration -- localtime returns the year minus 1900. So you need to add 1900 to get back to the current year.