Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 811117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:59:33+00:00 2026-05-15T00:59:33+00:00

i want my server time and date to be set as new date i

  • 0

i want my server time and date to be set as new date
i have tried this:

   dateNow = new Date("<%=now()%>");

but this is not working
how can i do this?

here is the code that give me the problem…
it is just get stack on the time diff and doesn’t countdown

<script type="text/javascript">
dateFuture = new Date(<%=year(privatesellstartdate)%>,<%=month(privatesellstartdate)-1%>,<%=day(privatesellstartdate)%>,<%=hour(privatesellstarttime)%>,<%=minute(privatesellstarttime)%>,00);

function GetCount(){
dateNow = new Date(<%=year(date())%>,<%=month(date())-1%>,<%=day(date())%>,<%=hour(time())%>,<%=minute(time())%>,00);               //grab current date
    amount = dateFuture.getTime() - dateNow.getTime();      //calc milliseconds between dates
    delete dateNow;

    // time is already past
    if(amount < 0){
        document.getElementById('countbox').innerHTML="Now!";
}
    // date is still good
    else{
        days=0;hours=0;mins=0;secs=0;out="";

        amount = Math.floor(amount/1000);//kill the "milliseconds" so just secs

        days=Math.floor(amount/86400);//days
        amount=amount%86400;

        hours=Math.floor(amount/3600);//hours
        amount=amount%3600;

        mins=Math.floor(amount/60);//minutes
        amount=amount%60;

        secs=Math.floor(amount);//seconds

        if(days != 0){out += days +":";}
        if(days != 0 || hours != 0){out += hours +":";}
        if(days != 0 || hours != 0 || mins != 0){out += mins +":";}
        out += ((secs>=10)?secs:"0"+secs) ;
        document.getElementById('countbox').innerHTML=out;

        setTimeout("GetCount()", 1000);
    }
}
window.onload=GetCount;//call when everything has loaded

</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T00:59:34+00:00Added an answer on May 15, 2026 at 12:59 am

    VBScript’s Now returns the date and the time like:

    5/27/2010 6:06:39 PM 
    

    JavaScript’s Date() constructor doesn’t like that particular format. Instantiating a JavaScript Date with time from a string requires the time to be in 24h format. It looks like you’re trying to cobble it together correctly in the code you pasted though. Not sure why that isn’t working.

    My question is why do the date comparison on the client-side at all? VBScript’s DateDiff would take care of this for you on the server-side:

    var seconds = <%= DateDiff("s", Now, privatesellstartdate) %>;
    
    if (seconds > 0) {
      var days = <%= DateDiff("d", Now, privatesellstartdate) %>;
    
      var hours = <%= DateDiff("h", Now, privatesellstartdate) %>;
    
      var minutes = <%= DateDiff("n", Now, privatesellstartdate) %>;
    
      // Your logic here.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want user to wait for specified time(4seconds) to get connected to server. If
Our git server will be local, but we want an server where our local
I want the IIS server to return HTTP 304 (Not Modified) when a particular
I'm setting up a new development server and want to install the latest version
I have a connection to a Microsoft SQL Server and want the change the
So I have access to a dedicated server and want to finally create my
A user can set a day alert for a birthday. (We do not care
I want my flot graph to update it's data on set intervals. I have
On a given server, I have a set of daemons each of which has
I have a date stored in a database in this format: 2011-02-23 13:00:00 I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.