[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



use POSIX qw(mktime ctime);

sub _time {
        my $string = shift;
        $string =~ m/^(\d+):(\d+):(\d+)\s+(.+)\s+(\d+)-(.+)-(\d+)$/;
        my $year = $7 - 1900;
        print "[$1] [$2] [$3] [$4] [$5] [$6] [$year]\n";
        my $t = mktime($3, $2, $1, $5, 4 ,$year);
        $lt = $t - (3600 * 5);
        print "$t, $lt, ",ctime($lt),"\n";
}

_time "23:50:04 UTC 05-MAY-2005";

On Sat, 2005-05-07 at 12:16, Christopher Fowler wrote:
> Here is my idea.
> 
> 1.  Convert the UTC date to epoch
> 2.  Subract the gmtoff from that value
> 3.  Now I have a value that is an epoch in localtime.
> 
> 
> On Sat, 2005-05-07 at 11:16, Christopher Fowler wrote:
> > I guess a simplier thing I'm trying to explain is that I wantto convert
> > localtime on the device into localtime on the server since all
> > dates in the database are stored in localtime of the server.
> > 
> > On Sat, 2005-05-07 at 10:59, Christopher Fowler wrote:
> > > I am receiving time strings in the format like this
> > > 
> > > "00:00:00 UTC"
> > > 
> > > I could receive timezones like EDT.  What I need to do is convert
> > > that time into an epoch on my server.  The server will receive that 
> > > string from the remote device and the server is in Eastern or Central.
> > > Anywhere in the US.  So I will be converting that UTC time int the exact
> > > time on the server.  Any ideas on how best to accomplish this?
> > > 
> > > Chris
> > > 
> > > 
> > > _______________________________________________
> > > Ale mailing list
> > > Ale at ale.org
&gt; &gt; &gt; <a  rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale";>http://www.ale.org/mailman/listinfo/ale</a>
&gt; &gt; 
&gt; &gt; _______________________________________________
&gt; &gt; Ale mailing list
&gt; &gt; Ale at ale.org
&gt; &gt; <a  rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale";>http://www.ale.org/mailman/listinfo/ale</a>
&gt; 
&gt; _______________________________________________
&gt; Ale mailing list
&gt; Ale at ale.org
&gt; <a  rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale";>http://www.ale.org/mailman/listinfo/ale</a>


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00106" href="msg00106.html">[ale] Converting time in perl</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
<li><strong><a name="00108" href="msg00108.html">[ale] Converting time in perl</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
<li><strong><a name="00109" href="msg00109.html">[ale] Converting time in perl</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00109.html">[ale] Converting time in perl</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00111.html">[ale] slackware 10.1 crash</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00109.html">[ale] Converting time in perl</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00113.html">[ale] There has to be a way -- right?</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00110"><strong>Date</strong></a></li>
<li><a href="threads.html#00110"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>