![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Daylight savings time | vbagwell | AIX | 2 | 03-11-2008 11:14 AM |
| Day Light Savings Time problem | uadm26 | AIX | 2 | 11-07-2007 11:19 AM |
| Day light savings | Tweedy | UNIX for Dummies Questions & Answers | 0 | 10-31-2007 12:37 PM |
| Daylight Savings Time Fix | stocksj | SUN Solaris | 5 | 02-21-2007 12:17 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
|||||
|
For my solution see: Understanding Unix Timekeeping
If you don't like my solution and decide to ask for another, tell us what OS you are using. |
|
|||||
|
DateTime module did the job very well.
Here is an example. Code:
#! /usr/bin/perl
use Time::Local;
($s,$min,$h,$d,$m,$y,$dst) = (localtime)[0,1,2,3,4,5,8];
$m +=1;
$y += 1900;
########################################
use DateTime;
$dt = DateTime->new(
year => $y,
month => $m,
day => $d,
hour => $h,
minute => $min,
second => $s,
nanosecond => 500000000,
time_zone => 'America/New_York',
);
$dt->set_time_zone('UTC');
print $dt->datetime;
print $dt->time_zone_short_name;
print "\n";
$dt->set_time_zone('America/New_York');
print $dt->datetime;
print $dt->time_zone_short_name;
print "\n";
$dt->set_time_zone('America/Chicago');
print $dt->datetime;
print $dt->time_zone_short_name;
print "\n";
Code:
2007-08-27T23:18:50UTC 2007-08-27T19:18:50EDT 2007-08-27T18:18:50CDT |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|