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>
ASPJavaScript

Avatar of undefined
Last Comment
dave doyle
ASKER CERTIFIED SOLUTION
Avatar of Eddie Shipman
Eddie Shipman
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
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?
Avatar of Eddie Shipman
Eddie Shipman
Flag of United States of America image

Yes, it can convert the time zones as well.
Avatar of dave doyle
dave doyle

ASKER

Thank you . I'll give it a try.
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo