I have to convert date format in to mm-dd-yyyy
I don't know what is the current date format it is dynamic so if I have dynamic date format is already in mm-dd-yyyy
then date()
function is returning below outout
$date='02-13-2011';
echo date('m-d-Y',strtotime($date));
output is
01-01-1970
?>
http://codepad.org/AFZ6jel7
So I have to check if the date is already in mm-dd-yyyy
then do not apply date formatting.
Is there any other way do this? may be passing one other parameter in these functions or something similar.
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…