Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 19-12-2008
Member
 
Join Date: Dec 2008
Posts: 12
How to Display Date 30 Days From Today

Hi

I want programme which will Display Date 30 Days From Today in HTML can someone help me ?


Thanks
Reply With Quote
  #2  
Old 19-12-2008
Member
 
Join Date: Aug 2008
Posts: 30
Re: How to Display Date 30 Days From Today

The example below demonstrates the usage of creating a web page which will display the date after adding 30 days in it from today. Suppose today's date is 29-07-03, then it will display 28-08-03 i.e. after adding 30 days in todays date. The date method is used for getting the current date and DateAdd method is used to add a time interval to any date.

Syntax for DateAdd is DateAdd(interval,number,date). In the following example, interval is "d" which states that you want to add the number (second argument) in the date field of third argument i.e. date. You could have used "m" also to add some interval in the month field of the date.


For embedding a VBScript code into your HTML page, you have to use a tag <script type= ""> to tell the HTML page that you are going to use a script now. This script type can JavaScript or VBScript and then you can use the functionalities of Javascripting or VBScripting as per your requirement. We have written the code in the body section of the HTML page.The reason for using VBScript functions in the body section is to be sure that the script is executed when the page is loading. As in the example, you can see that it will write a message on your web page at the time of loading of HTML page.

The document.write() method of VBScript is used to display something on the HTML page.

The HTML element <p> indicates the start of a paragraph block. This means that the current line of output is terminated and a blank new line is output before text display continues. If a <p> tag is encountered within a paragraph block this forces the start of a new paragraph. <b> </b> element of HTML states that the text enclosed within these tags will be displayed as bold text.

Code:
<html>

<title>Dateadd function</title>

<body>

<script type="text/vbscript">

document.write(DateAdd("d",30,date()))

</script>

<p>

This example uses <b>DateAdd</b> to calculate a date 30 days from today.

</p>

</body>

</html>
<html> </html> is the tag for starting the html file and ending it. <title> </title> tag defines what you want to be the title of your window/web-page i.e. Title bar of the web-page. The body i.e. what you want to display on your web page will come in between the <body> </body> tag.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to Display Date 30 Days From Today"
Thread Thread Starter Forum Replies Last Post
Marking today?s date in different color in Mozilla Calendar Elias Blackman Technology & Internet 4 02-03-2012 01:16 PM
Need a formula to calculate years/days/months among several date in Excel Kumar esan MS Office Support 2 16-02-2012 08:05 PM
Shortcut for Today's date in Excel 2007 stephenx Windows Software 3 24-06-2009 06:04 PM
Date, days in HTML Jacob Software Development 4 09-02-2009 09:17 PM
Duration shown in days(need) to display hours The Man Microsoft Project 0 23-09-2008 05:26 PM


All times are GMT +5.5. The time now is 04:55 PM.