I want to convert a date in the format "MM-dd-yyyy" to "yyyyMMdd" inside a javascript.
I can do it in
java :
private static
String (String old_Date, String oldF, String newF) {
SimpleDateFormat oldFormat = new SimpleDateFormat(oldF);
Date oldDate = null;
try {
oldDate = oldFormat.parse(old_Date);
} catch (ParseException e) {
return null;
}
SimpleDateFormat newFormat = new SimpleDateFormat(newF);
return newFormat.format(oldDate);
}
Can someone please tell me how can I do this inside a javascript file ?