dave doyle
asked on
Need help with javascript date format
Need help getting this JavaScript to format with different date options like mm/dd/yyyy , mm/dd/yyyy 00:00 etc.
<%@ language="VBScript" %>
<!DOCTYPE html>
<html>
<head>
<script language='Javascript' runat='server'>
function jsGetPastTimeCurrent(minut es) {
var d = new Date();
var past = new Date();
past.setTime(d.getTime() + (minutes*60000));
var utcString = past.toUTCString();
var tz = utcString.indexOf("UTC");
if (tz > 0) {
utcString = utcString.substring(0, tz) + "CT";
}
return utcString;
}
</script>
<% newDate=jsGetPastTimeCurre nt(-360)%>
<title>Timestamp</title>
</head>
<body>
<p>
<h2><%= newDate %> </h2>
</p>
</body>
</html>
<%@ language="VBScript" %>
<!DOCTYPE html>
<html>
<head>
<script language='Javascript' runat='server'>
function jsGetPastTimeCurrent(minut
var d = new Date();
var past = new Date();
past.setTime(d.getTime() + (minutes*60000));
var utcString = past.toUTCString();
var tz = utcString.indexOf("UTC");
if (tz > 0) {
utcString = utcString.substring(0, tz) + "CT";
}
return utcString;
}
</script>
<% newDate=jsGetPastTimeCurre
<title>Timestamp</title>
</head>
<body>
<p>
<h2><%= newDate %> </h2>
</p>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yes, it can convert the time zones as well.
ASKER
Thank you . I'll give it a try.
ASKER