Illera, Fernando wrote:
Thanks Mac.

I have tried as you recommended:

my($now) = time();
Here's your problem.

time() returns the number of seconds since the epoch which I think DBMS will struggle with.

You need to convert that time() value to something more usefull, you might get away with this:

my $now = localtime($now);

If not try one of these:

sub time_to_SQL {
        my $tm = shift;
        my @months = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec);
        my ($sec, $min, $hour, $day, $mon, $year) = (gmtime $tm)[0..5];
        $mon = $months[$mon];
        return (sprintf "%02u %03s %4u %02u:%02u:%02u",
                        $day, $mon, $year + 1900, $hour, $min, $sec);
}


sub time_to_ODBC { my $tm = shift; my ($sec, $min, $hour, $day, $mon, $year) = (gmtime $tm)[0..5]; return (sprintf "%4u-%02u-%02u %02u:%02u:%02u", $year + 1900, $mon+1, $day, $hour, $min, $sec); }

--
  Simon Oliver



Reply via email to