answersLogoWhite

0

Insert date on a webpage using javascript?

Updated: 8/18/2019
User Avatar

Wiki User

11y ago

Best Answer

Just use new Date(); to get the current date and then use document.getElementById to insert it on the webpage.

<div id="example"></div>

<script type="text/javascript">

document.getElementById('example') = new Date();

</script>

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Insert date on a webpage using javascript?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Insert date on web page?

Using PHP: &lt;?php echo date("d/m/y"); ?&gt;


Which websites have information about the JavaScript date object?

There are a lot of websites which have information about the JavaScript date object. However, it is strongly suggested that one should check out from the website W3Schools.


How do you display the date and time using HTML?

HTML can't get the time for you, so the best way to do it is to use Javascript inside your page, like this: &lt;script language="javascript"&gt; &lt;!-- today = new Date(); document.write("&lt;BR&gt;The time now is: ", today.getHours(),":",today.getMinutes()); document.write("&lt;BR&gt;The date is: ", today.getDate(),"/",today.getMonth()+1,"/",today.getYear()); //--&gt; &lt;/script&gt; Copy and paste that into your web page code. It will show you the date and time.


What is the conception date if your due date is June 20Th?

Copy and paste this link into your address bar. You can calculate your conception date using the conception calculator on this webpage. http://www.baby2see.com/conception_calculator.html#ConceptionCalculator


When did you conceive if your due date is April 8?

Copy and paste this link into your address bar. You can calculate your conception date using the conception calculator on this webpage. http://www.baby2see.com/conception_calculator.html#ConceptionCalculator


If your due date is feb 7th 2010 when did you conceive?

Copy and paste this link into your address bar. You can calculate your conception date using the conception calculator on this webpage. http://www.baby2see.com/conception_calculator.html#ConceptionCalculator


What to insert the current time into a document click the insert date and time button?

Insert.


When did you conceive if birthday is Feb 16?

Copy and paste this link into your address bar. You can calculate your conception date using the conception calculator on this webpage. http://www.baby2see.com/conception_calculator.html#ConceptionCalculator


Why did damnlolcom randomly turn the webpage upside down?

Check the date ;-)


The first day of your last menstrual period was march10 your due date is December 21 when did you conceive?

Copy and paste this link into your address bar. You can calculate your conception date using the conception calculator on this webpage. http://www.baby2see.com/conception_calculator.html#ConceptionCalculator


If you had your son September 23 1996 when did you conceive?

Copy and paste this link into your address bar. You can calculate your conception date using the conception calculator on this webpage. http://www.baby2see.com/conception_calculator.html#ConceptionCalculator


If due on April 14 2010 when did you get pregnant?

Copy and paste this link into your address bar. You can calculate your conception date using the conception calculator on this webpage. http://www.baby2see.com/conception_calculator.html#ConceptionCalculator