Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I manipulate a Sybase datetime string in Perl?

I have a datetime field in a Sybase table, and need to use it in Perl for doing some calculations (differences to make sure I'm picking up the records that are at least 'n' mins apart). Now, if I simply do a select <datetime field>, Sybase returns a human readable field which is no use to me. I was looking at some way to convert this into say, an epoch based time, which will allow me to manipulate them easily in Perl.

I could be wrong but I didn't find an existing function for this in Sybase. The closest I got was datediff, which serves my purpose fine. In fact, I am using that as a workaround for now. The problem with datediff is because of the limitation on integer, it's capped at 68 years. I know my code probably won't be around till that time, but why introduce such a time-based limit on my own?

Is there a way to get around this?

Thanks!

like image 788
ak86 Avatar asked Feb 10 '09 02:02

ak86


1 Answers

If you're ok with doing it in the client, the Time::ParseDate module should be able to do the work for you.

like image 128
Jay Kominek Avatar answered Sep 23 '22 04:09

Jay Kominek