I am trying to compare a timestamp to a variable which has been set by three drop down menus, from which the user picked a month, day, and year. now my code does this:
The problem is, timestamps have a zero in the tens place if the number is smaller than 10, so 1 shows up as 10. This causes a problem because the timestamp
2005-01-27
will not match even if the user has selected January 27, 2005, because my $date will be set to:
2005-1-27
I know I should be able to use sprintf to pad $date with zeros, but the syntax is bogging me down.. can anyone help me??
thanks!!
Code:
my $date = $year.'-'.$month.'-'.$day;
The problem is, timestamps have a zero in the tens place if the number is smaller than 10, so 1 shows up as 10. This causes a problem because the timestamp
2005-01-27
will not match even if the user has selected January 27, 2005, because my $date will be set to:
2005-1-27
I know I should be able to use sprintf to pad $date with zeros, but the syntax is bogging me down.. can anyone help me??
thanks!!