Im kinda lost, I need all of the dates to be formated to a Postgres happy state. Can you help?
Code I have been trying to work with (its lying.. not php):
Thanks!!PHP Code:if($format eq "MM-DD-YYYY")
{
if($data =~ /-/){
($month,$day,$year) = split("-",$data) if $data =~ /-/;
($month,$day,$year) = split("/",$data) if $data =~ /\//;
$month = "01" if ($month == 0);
$year = "2000" if ($year == 0);
$day = "01" if ($day == 0);
$data="$year-$month-$day";
} else {
#try to form a correct date
if(length($date) == 8 || length($date) == 6) {
#2004-01-01 (20040101)
$date =~ s/\d{2}\d{2}\d{4}/\d{2}-\d{2}-\d{4}/e;
}
}
![]()




Reply With Quote