Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / February 2006

Tip: Looking for answers? Try searching our database.

script that displays date 10 days in future

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
stef25 - 13 Feb 2006 14:23 GMT
im using the script below to display todays date. Could someone tell me
how to alter this script so that is displays the date 10 days in the
future? So, if its 01-Jan-06 today, it should actually display
10-Jan-06. Thanks ...

function getDateString(oDate)
{
    // Use today as default value.
    if (oDate == null)
         oDate = new Date();

    var m = oDate.getMonth() + 1;
    var d = oDate.getDate();

    if (m < 10)
             m = "0" + m;

    if (d < 10)
        d = "0" + d;

    // ISO 8601 date (YYYY-MM-DD).
    return oDate.getFullYear() + "-" + m + "-" + d;
}
ermouth - 13 Feb 2006 22:01 GMT
it can be smth like this:

var dtToday = new Date();
var iMillisecondsPerDay = 24*60*60*1000;
var dtTenDaysAfter = new Date(dtToday .valueOf()+10*iMillisecondsPerDay);
var sTenDaysAfter = getDateString (dtTenDaysAfter);

voila :)

Signature

sincerely, ermouth

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.