Print out the current time in standard time : date time « Data Type « Perl






Print out the current time in standard time

  
    #!/usr/local/bin/perl -w

    my $time = time;

    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime ($time);

    my $newtime = $time - ($isdst * 3600);
    my $stdtime = localtime ($newtime);
    my $daytime = localtime ($time);

    print "The current daylight time is: $daytime\n";
    print "The current standard time is: $stdtime\n";

   
    
  








Related examples in the same category

1.To extract the current date by using time and localtime
2.Set the value of localtime to a scalar variable, you'll get a typical UNIX-style time
3.scalar(localtime(time()))
4.Splitting Time
5.Create new time based on the value from localtime
6.Is leap year subroutine
7.Execute date command and get user input
8.Time of Day
9.Switch Time
10.Converting Time
11.Splitting Local Time
12.localtime converts a time into the local time.
13.gmtime function converts a time value into Greenwich Mean Time