baperl has asked for the wisdom of the Perl Monks concerning the following question:
so, for testing, I replaced $t_dt with the below, and it shows the current date and time in the table as it should, but since I am dealing with past dates, I can't use the below.my $t_dt = $ARGV [0]; my $t_price = $ARGV [1]; my $ins_r = "INSERT INTO $tbl_name (t_dt, t_price) VALUES (?,?);"; $sth=$dbh->prepare($ins_r) or die $dbh->errstr;
how can I format my $t_dt so when I enter a previous date(and time) at the commandline it gets inserted correctly into mySQL. thx!my $t_dt=strftime('%Y-%m-%d %H:%M:%S',localtime);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: timestamp in perl
by Anonymous Monk on Sep 24, 2011 at 17:18 UTC | |
by baperl (Sexton) on Sep 24, 2011 at 17:42 UTC | |
by AnomalousMonk (Archbishop) on Sep 24, 2011 at 18:03 UTC | |
by baperl (Sexton) on Sep 24, 2011 at 18:25 UTC | |
by Anonymous Monk on Sep 24, 2011 at 19:23 UTC | |
|