Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Problem converting with FROM_UNIXTIME

by martell (Hermit)
on Jun 23, 2011 at 13:17 UTC ( [id://911081]=note: print w/replies, xml ) Need Help??


in reply to Problem converting with FROM_UNIXTIME

Hi

I would like to help you, but you need to give some extra information. What is the exact perl module you are using: DBI, Class::DBI, DBIx::Class ... ? And on what kind of databank are you running: Postgresql, Oracle, mySQL ... ? And what is the exact output resulting from print statement: an error, a string with nothing in, something like HASHx.., ... ?

In my experience, the problem is often the correct use of the quotations in the statement. For example, when using mySQL, if find using backtick quotes ` on every column a good rule to avoid problems. Also use the qq{} notation to avoid any change of misinterpretation by perl when parsing your select statement, especially when using using variables (which you are not doing here, but better save than sorry).

So, try once:

my $sth = $db_h->Query(qq{ SELECT `serial_num`, FROM_UNIXTIME(`trans_date`) AS `Action_date +`, `actor`, `type`, `trans_data`, `content` FROM `transtable` ORDER B +Y `serial_num`; });

Kind Regards

Martell

update:

Try first the suggestion of rev_1318 below. Didn't spot the issue in his remark, but after reading it, I think he's right.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://911081]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-25 23:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found