#!/usr/bin/perl -T
use strict;
use Date::Manip;
my $raw_date1 == $ARGV[0];
# Default to today if date is blank:
if ( $raw_date1 == "" ) {
print "In blank date check. But is the date truly blank? It is in fact \"$raw_date1\"\n";
$raw_date1 = UnixDate("today","%Y-%m-%d");
};
$raw_date1 = ParseDate($raw_date1);
# fix the dates to MySQL format:
my $date1 = UnixDate($raw_date1,"%Y-%m-%d");
print "$raw_date1 was changed to $date1\n";
####
jfzuelow@city-liza-lnx:~$ ./odd-date.pl
In blank date check. But is the date truly blank? It is in fact ""
2013020200:00:00 was changed to 2013-02-02
####
jfzuelow@city-liza-lnx:~$ ./odd-date.pl "15 jan"
2013011500:00:00 was changed to 2013-01-15
####
jfzuelow@city-liza-lnx:~$ ./odd-date.pl "jan 15"
In blank date check. But is the date truly blank? It is in fact "jan 15"
2013020200:00:00 was changed to 2013-02-02