Home : General : Perl Programming :

General: Perl Programming: Re: [nsync] Conversion to unix time: Edit Log

Here is the list of edits for this post
Re: [nsync] Conversion to unix time
to all pro,

have another question regarding to time (GMT).

print "Please enter unix time stamp\n";
chomp($unix_stmp = <STDIN>);
use Time::Local;
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($unix_stmp);
$year += 1900;
$mon += 1;
print "Real time = $hour:$min:$sec $mday/$mon/$year\n";


Above is my coding. It will get unix time from user and convert it to real time. I have some question on it. I try to add 8 hours with my code but it cause lot of trouble, the date/month/year might change as well. below is my question

1. the time i get is in GMT, i would like to get the answer in my area which is GMT + 8. So any idea on this ? (others than add 8 hours to $hour)


thanks lot if can help !

Last edited by:

nsync: Nov 17, 2005, 5:43 AM

Edit Log: