| Perl script: issue with dates [message #408450] |
Tue, 16 June 2009 04:49  |
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   |
|
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   |
Michel Cadot Messages: 28991 Registered: March 2007 Location: Nanterre, France, http://... |
Senior Member |
|
|
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]
|
|
|
|