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.
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.
<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>
|Tags: date, days, display|
|Thread Tools||Search this Thread|
|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|