Link to home
Start Free TrialLog in
Avatar of dave doyle
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(minutes) {
                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=jsGetPastTimeCurrent(-360)%>
        <title>Timestamp</title>
    </head>
    <body>
    <p>
    <h2><%= newDate %> </h2>
    </p>
    </body>
</html>
ASKER CERTIFIED SOLUTION
Avatar of Eddie Shipman
Eddie Shipman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dave doyle
dave doyle

ASKER

I've seen that . My web server is UTC but I need central time . Do you think it would work?
Yes, it can convert the time zones as well.
Thank you . I'll give it a try.