Home » Open Source » Programming Interfaces » Perl script: issue with dates
Perl script: issue with dates [message #408450] Tue, 16 June 2009 04:49 Go to next message
f_vinodh
Messages: 3
Registered: June 2009
Junior Member
Hi

I have one another Q

i implemented an sqlquery in perl as follows

my $sth1 = $db->prepare("SELECT TO_CHAR(SYSDATE, 'YYYYMMDDHHMISS') from dual") or die "Couldn't prepare statement: " . $db->errstr;
my @dat1;
$sth1->execute() or die "Couldn't execute statement: " . $sth1->errstr;
@dat1 = $sth1->fetchrow_array();
print $dat1[0];
print $dat1[1];


i am getting the out put as "20090616034633"

but if i execute the statement directly in SQL Prompt, i am getting the CORRECT out put as follows

SQL> SELECT TO_CHAR(SYSDATE, 'YYYYMMDDHHMISS') from dual;

TO_CHAR(SYSDAT
--------------
20090616064754

SQL> !date
Tue Jun 16 06:47:57 EDT 2009


Can you please help me why there is a difference in time

direct query says the hour is 06 (which is correct)
Query thru perl script , hour is 03(which is wrong)

Please explain where i am missing

Thanks in advance

Regards
Vinodh




Re: Database connection Problem [message #408452 is a reply to message #408450] Tue, 16 June 2009 04:54 Go to previous messageGo to next message
babuknb
Messages: 1736
Registered: December 2005
Location: NJ
Senior Member


If you have any new query; please start new thread don't continue same thread.

>>Can you please help me why there is a difference in time

Where is the difference? AS per your sQL Query it's giving exact date,month & year but hours , minutes & seconds it's should be change every second.

Thanks
Re: Database connection Problem [message #408463 is a reply to message #408450] Tue, 16 June 2009 05:45 Go to previous messageGo to next message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Also post your query in the correct forum.

If it is SQL, post in SQL & PL/SQL but remove Perl stuff.
If it is Perl issue, post in Open Database Interfaces.

Topic is split and move to this latter one for the moment.

Regards
Michel

[Updated on: Tue, 16 June 2009 05:46]

Report message to a moderator

Re: Perl script: issue with dates [message #408525 is a reply to message #408450] Tue, 16 June 2009 10:01 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>Can you please help me why there is a difference in time
I suspect that the DB server & the Perl client systems are in different timezones & 3 hours apart.
Previous Topic: ora-30550 problem in ole2
Next Topic: Oracle Lite 10g c# and ODBC
Goto Forum:
  


Current Time: Thu Dec 05 06:28:22 CST 2024