in reply to seconds into a date
localtime takes a number of seconds since the epoch (usually 1st Jan 1970) and returns information about the date and time.
For more complex requirements, I recommend looking at DateTime.
#!/usr/bin/perl use strict; use warnings; use DateTime; # 1st Jan 2000 my $date = DateTime->new(year => 2000, month => 1, day => 1); # Add a million seconds $date->add(seconds => 1_000_000); # See what you get - 2000-01-12T13:46:40 print $date;
Update: Actually you can also do something similar using only modules from the standard distribution.
#!/usr/bin/perl use strict; use warnings; use Time::Local; # Warning: The parameters to timelocal can be a bit confusing # Read the documentation carefully my $date = timelocal(0, 0 , 0, 1, 0, 100); $date += 1_000_000; print scalar localtime $date;