CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [FishMonger] Time Conversion Issue: Edit Log



TheBigAmbulance
Novice

Jul 16, 2012, 7:58 AM


Views: 6183
Re: [FishMonger] Time Conversion Issue

Thanks for the info FishMonger...

I have rewritten a portion of my script to use the following:


Code
  my $systemTZ =  int(substr(strftime("%z", localtime()),0,3)); 
my $offendingTZ;

if ($TZ =~ m/(Z|z)/) {
$offendingTZ = 0;
} else {
$TZ =~ s/:00//g;
$offendingTZ = int($TZ);
}


This works to get the data as an interger I can work with. So now I have my system time zone ($systemTZ) and the offending info time stamp ($offendingTZ).

What I would like to do is configure a $deltaTZ so that I can rewrite the variable $hour by the difference.

For example... When $systemTZ is -5 and $offendingTZ is 0, I need to adjust the variable $hour -5 hours to convert ZULU time to the local time zone of the box. Likewise, if the $systemTZ is -5 and $offendingTZ is -4, I need to adjust the variable $hour -1 hour to convert EST to local time.

I am having a hard time trying to understand how an absolute value will help here, or did I go off on a tangent from what you suggested?

{EDIT} Actually, that won't work (modifying the variable $hour) because what happens when the time is around midnight, and the $date variable will need to change as well. Best bet is to take the variables ($offendingTZ and $systemTZ) and do a time zone conversion. However, I am having a hard time finding a script that doesn't use the actual names "I.E. CST".


(This post was edited by TheBigAmbulance on Jul 16, 2012, 8:52 AM)


Edit Log:
Post edited by TheBigAmbulance (Novice) on Jul 16, 2012, 8:09 AM
Post edited by TheBigAmbulance (Novice) on Jul 16, 2012, 8:52 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives