Results 1 to 2 of 2

Thread: How to Display Date 30 Days From Today

  1. #1
    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

  2. #2
    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.

Similar Threads

  1. Marking today’s date in different color in Mozilla Calendar
    By Elias Blackman in forum Technology & Internet
    Replies: 4
    Last Post: 02-03-2012, 01:16 PM
  2. Replies: 2
    Last Post: 16-02-2012, 08:05 PM
  3. Shortcut for Today's date in Excel 2007
    By stephenx in forum Windows Software
    Replies: 3
    Last Post: 24-06-2009, 06:04 PM
  4. Date, days in HTML
    By Jacob in forum Software Development
    Replies: 4
    Last Post: 09-02-2009, 09:17 PM
  5. Duration shown in days(need) to display hours
    By The Man in forum Microsoft Project
    Replies: 0
    Last Post: 23-09-2008, 05:26 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,565,063.45581 seconds with 16 queries