PerlingTheUK has asked for the wisdom of the Perl Monks concerning the following question:
I am retreiving these times with the follwing piece of code:00/01/1900 00:31:00
The second bit is used to convert non-Variant times to a time format. Unfortunately the time in the example above is converted as "12:31:00", which as you might imagine has some unpleasant effects. Has anyone any ideas how to tackle this? I am using AS Perl 5.8.6 and Excel 2002. Thank you for all help.if ( ref( $value ) =~ /Variant/ ){ if ( $iRef == 4 || $iRef == 6 ){ $value = $value->Date( "dd/MM/yy" ); } elsif ( $iRef == 5 || $iRef == 7 ){ $value = $value->Time( "hh:mm:ss" ); } } if ( $values ne "" && $value =~ /^\d?\.\d*$/ ){ print $value; my $seconds = $value * 60 * 60 * 24; print $seconds; my ( undef, undef, undef, $hour,$min,$sec)= Date::Calc::Add_Delta_ +DHMS( 1900, 1, 1, 0, 0, 0, 0,0,0, $seconds); $value = sprintf( "%02u:%02u:%02u", $hour, $min, $sec ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl OLE Time Formatting Error!?
by NetWallah (Canon) on Jun 01, 2005 at 02:43 UTC | |
by PerlingTheUK (Hermit) on Jun 01, 2005 at 09:11 UTC |