I would like to use a date picker on a web page input form. I found one
which does what I want but the date format it outputs is not correct for my
form. The script contains the following:
// datetime parsing and formatting routimes. modify them if you wish other
datetime format
function str2dt (str_datetime) {
var re_date = /^(\d+)\-(\d+)\-(\d+)\s+(\d+)\:(\d+)\:(\d+)$/;
if (!re_date.exec(str_datetime))
return alert("Invalid Datetime format: "+ str_datetime);
return (new Date (RegExp.$3, RegExp.$2-1, RegExp.$1, RegExp.$4,
RegExp.$5, RegExp.$6));
}
function dt2dtstr (dt_datetime) {
return (new String (
dt_datetime.getDate()+"-"+(dt_datetime.getMonth()+1)
+"-"+dt_datetime.getFullYear()+" "));
}
function dt2tmstr (dt_datetime) {
return (new String (
dt_datetime.getHours()+":"+dt_datetime.getMinutes( )
+":"+dt_datetime.getSeconds()));
}
I am not familiar with JavaScript and have not been able to figure out what
changes I need to make in order to get the output I want. I tried to
contact the author, but his email address no longer works. I would greatly
appreciate it if someone could tell me what modifications are necessary.
The output format I'm looking for is YYYY-MM-DD (no time).