| | |
please help me in javascript
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2006
Posts: 11
Reputation:
Solved Threads: 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>
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>
•
•
Join Date: Apr 2007
Posts: 3
Reputation:
Solved Threads: 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.
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.
Last edited by richfeed; Apr 16th, 2007 at 4:45 pm. Reason: code visible
![]() |
Similar Threads
- Javascript links not working (Web Browsers)
- JavaScript's window.opener (JavaScript / DHTML / AJAX)
- recommendations for JavaScript learning resources? (JavaScript / DHTML / AJAX)
- Javascript/HTML problem!!! (JavaScript / DHTML / AJAX)
- Javascript Useful? (IT Professionals' Lounge)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Java Script
- Next Thread: I used Javascript now I cant edit my page PLEASE HELP!!
| Thread Tools | Search this Thread |
acid2 ajax ajaxexample ajaxjspservlets array browser captcha captchaformproblem cart child class close codes column css date debugger decimal dependent design disablefirebug dom download editor element embed engine enter error events explorer ext file firefox focus form forms frameworks getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe index java javascript javascripthelp2020 jquery jsf jsp jump libcurl listbox maps masterpage math media menu mp4 object onerror onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php position post problem programming prototype rated rating redirect safari scale scriptlets scroll search security select software star starrating stars synchronous toggle unicode variables w3c web webservice \n





