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

  • Home
  • SEARCH
  • 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 8190247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:33:32+00:00 2026-06-07T03:33:32+00:00

Hi I am new to Javascript and am trying to create a function that

  • 0

Hi I am new to Javascript and am trying to create a function that checks two dates. I have read it is useful to put the JS in the head part of the document, but this is not returning anything. I am also new to stackoverflow so I hope I did this correctly. 🙂 Does anyone see the error?

<!DOCTYPE html>
<html>
<head>

var myDate = new Date(); // Your timezone!
var myEpoch = myDate.getTime()/1000;
var deadline = '1341596750.000';

document.write(myEpoch);
document.write("<br>",deadline);

if (myEpoch < deadline) {
  document.write("<p>Just in time!</p>");
} else {
  document.write("<p>Too late!</p>");
}

</head>
<body>

<br><br><br><br>http://www.epochconverter.com/
</body>
</html>
  • 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-06-07T03:33:33+00:00Added an answer on June 7, 2026 at 3:33 am

    You have to mention it’s a script using <script>. Also you shouldn’t output DOM in the <head> like you are doing with document.write. Manipulate the DOM like this instead:

        <head>
        <script type="text/javascript">
    
        var myDate = new Date(); // Your timezone!
        var myEpoch = myDate.getTime()/1000;
        var deadline = '1341596750.000';
    
        document.write(myEpoch);
        document.write("<br>",deadline);
    
        if (myEpoch < deadline) {
          document.getElementById("useme").innerHTML("Just in time!");
        } else {
          document.getElementById("useme").innerHTML("Too late!");
        }
        </script>
        </head>
    <body>
    
    <p id="useme"></p>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a javascript function that accepts 2 parameters min and max
i am trying to create a bit of javascript that will create a new
New to javascript and such, trying to create a loop for fading logos using
I'm completely new to javascript, but I'm trying to create a beta form for
I am trying to create a new Element in my javascript code and append
I'm quite new to JavaScript andI'm trying to do the following: I've two webpages
I'm basically trying to create a generic object in javascript that I can use
I am trying to create a button in javascript that when clicked adds an
I've been trying to create my own custom LiveValidation ( LiveValidation.com ) function that
I'm trying to create a function that will check to make sure all the

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.