Dear All,
In my work, I have to substract a day from a datetime object. For that I wrote a code segment like this.
<?php
$date_str = "2000-03-01 10:00:00";
$date_val1 = strtotime($date_str);
$date_array = getdate($date_val1);
$yy = $date_array["year"];
$mm = $date_array["mon"];
$dd = $date_array["mday"];
$hh = $date_array["hours"];
$mi = $date_array["minutes"];
$ss = $date_array["seconds"];
$prev_mth_last_day = mktime($hh, $mi, $ss, $mm, ($dd - 1), $yy);
print date("Y M d H:i:s", $prev_mth_last_day);
?>
This is returning me "2000 Feb 29 10:00:00". But I need it as "2000-02-29 10:00:00". Can anybody kinly find a simple way to change it?
regards,
M.Indrajit