List Info

Thread: strange timestamp conversion




strange timestamp conversion
user name
2006-06-13 08:19:29
Hi at all!

I have written a simple code that convert timestamp unix in
local time.
Look....

use POSIX   qw( strftime );
use Time::Local;

$time = 1150186242  #taken from some log file.
strftime( "%Y/%m/%d %H:%M:%S", localtime( $time
) );

output --->   2006/06/13 10:10:42

It seems to work finely.

The really problem is in Oracle. I want to write tha same
code in SQL.
Look....

select

to_date(to_char((TO_DATE('01/01/1970 00:00:00',
'dd/mm/yyyy
hh24:mi:ss') + numtodsinterval(1150186242, 'SECOND')),
'dd/mm/yyyy
hh24:mi:ss'), 'dd/mm/yyyy hh24:mi:ss')

from dual

output---> 13/06/2006 8.10.42

.....but the oracle output date is 2 hours before. Why??


Did anybody ever meet this problem??
Thanks


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Perl Programming" group.
To post to this group, send email to perl-programminggooglegroups.com
To unsubscribe from this group, send email to
perl-programming-unsubscribegooglegroups.com
For more options, visit this group at http:
//groups.google.com/group/perl-programming
-~----------~----~----~----~------~----~------~--~---

strange timestamp conversion
user name
2006-06-16 15:27:27
Try to use gmtime instead of localtime in perl.
Then possibly you get equal results (in GMT)
Chudpi right, it's mostly the timezone problem

On 6/13/06, gino <milella_inwind.it> wrote:
>
> Hi at all!
>
> I have written a simple code that convert timestamp
unix in local time.
> Look....
>
> use POSIX   qw( strftime );
> use Time::Local;
>
> $time = 1150186242  #taken from some log file.
> strftime( "%Y/%m/%d %H:%M:%S", localtime(
$time ) );
>
> output --->   2006/06/13 10:10:42
>
> It seems to work finely.
>
> The really problem is in Oracle. I want to write tha
same code in SQL.
> Look....
>
> select
>
> to_date(to_char((TO_DATE('01/01/1970 00:00:00',
'dd/mm/yyyy
> hh24:mi:ss') + numtodsinterval(1150186242,
'SECOND')), 'dd/mm/yyyy
> hh24:mi:ss'), 'dd/mm/yyyy hh24:mi:ss')
>
> from dual
>
> output---> 13/06/2006 8.10.42
>
> .....but the oracle output date is 2 hours before.
Why??
>
>
> Did anybody ever meet this problem??
> Thanks
>
>
> >
>


-- 
Best wishes,
Vladimir V. Perepelitsa aka Mons <inthraxgmail.com>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Perl Programming" group.
To post to this group, send email to perl-programminggooglegroups.com
To unsubscribe from this group, send email to
perl-programming-unsubscribegooglegroups.com
For more options, visit this group at http:
//groups.google.com/group/perl-programming
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )