0

Dear All,

i write this html to get date in this format 4/1/2007 00:00:00
but output is Sun Apr 1 00:00:00 UTC+0200 2007.
please help me to convert it to this format 4/1/2007 00:00:00 to use it in select from al DB .:lol:

<html>
<head>
<SCRIPT type="text/javascript">
function startDate()
{
var d=new Date()
var y=d.getYear()
var m=d.getMonth()+1
var day=1
var date1=m+"/"+day+"/"+y

var result = new Date(date1)
document.write(result);
}
</SCRIPT>
</head>
<body onload="startDate()" >
</body>
</html>

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by richfeed
0

The second call to new Date(..) is converting output to a UTCString.
Simply comment out the line var result=new Date(date1) and instead document.write(date1).
You might also check your script lines end with";", use var y=d.getFullYear(), and append the zero'd time portion to the "date1" string.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.