in reply to Re^2: timestamp in perl
in thread timestamp in perl

... when I enter 2011-09-22 12:30:01 at the commandline ...

baperl:
You do not show in the OP exactly what you are entering at the command line, and the Devil is in the details.

If you enter something like
    perl myscript.pl 2011-09-22 12:34:56 19.95
then  $ARGV[0] will be '2011-09-22' and  $ARGV[1] will be '12:34:56' (and  $ARGV[2] will be '19.95' – the price?).

Try printing exactly what  $ARGV[0] is:
    print qq{'$ARGV[0]'};
or maybe quoting the date-and-time on the command line: '2011-09-22 12:34:56' (of course, use double-quotes for Windoze).

Replies are listed 'Best First'.
Re^4: timestamp in perl
by baperl (Sexton) on Sep 24, 2011 at 18:25 UTC
    yes indeed, you're right...that was the mistake I was making...thx!
        thanks, that's a lot of good info. maybe I can ask you another q :-) I am running this query, and it works fine in mySQL, i.e. md contains the right datetime value in mySQL. however, I don't believe mt is getting assigned md's value
        my $check_inv_sql = "SELECT MAX(cdt) AS md FROM s_i ORDER BY cdt LIMIT + 1"; $sth=$dbh->prepare($s_query) or die $dbh->errstr; $sth->execute; my $mt; if (my $hash_ref = $sth->fetchrow_hashref) { $mt = $hash_ref->{'md'}; print "$mt\n";#this returns below error }
        and the error it generates is
        Use of uninitialized value $mt in concatenation (.) or string at Sb.pl + line 56.
        It seems to me that I am not assigning md correctly to $mt. If that is indeed the case, how do I correct the above code....thx!