I would like the experation date to appear on the coupon.
I do have a coupon page on my website where I have used java script to have the
date acouple of days ahead show up on the web page with the coupons on it.
Here is a link to the page so you can see what I am doing now and what I want to
do in Acrobat thru LiveCycle Designer
<http://www.uptownimports.com/promotions.html>
Sorry about the multiple posts!!
This is the code below.
JavaScript Date Display
//Just Copy the javascript code code below and put it between the tags of //your
html page.
function dispDate(dateVal) {
DaystoAdd=dateVal
TodaysDate = new Date();
TodaysDay = new Array('Sunday', 'Monday', 'Tuesday','Wednesday', 'Thursday',
'Friday', 'Saturday');
TodaysMonth = new Array('January', 'February', 'March','April', 'May','June',
'July', 'August', 'September','October', 'November', 'December');
DaysinMonth = new Array('31', '28', '31', '30', '31', '30', '31', '31', '30',
'31', '30', '31');
function LeapYearTest (Year) {
if (((Year % 400)==0) || (((Year % 100)!=0) && (Year % 4)==0)) {
return true;
}
else {
return false;
}
}
CurrentYear = TodaysDate.getYear();
if (CurrentYear < 2000) CurrentYear = CurrentYear + 1900; currentMonth =
TodaysDate.getMonth(); DayOffset = TodaysDate.getDay(); currentDay =
TodaysDate.getDate(); month = TodaysMonth[currentMonth]; if (month ==
'February') { if (((CurrentYear % 4)==0) && ((CurrentYear % 100)!=0) ||
((CurrentYear % 400)==0)) { DaysinMonth[1] = 29; } else { DaysinMonth[1] = 28; }
} days = DaysinMonth[currentMonth]; currentDay += DaystoAdd; if (currentDay >
days) {
if (currentMonth == 11) {
currentMonth = 0;
month = TodaysMonth[currentMonth];
CurrentYear = CurrentYear + 1
}
else {
month =
TodaysMonth[currentMonth+1];
}
currentDay = currentDay - days;
}
DayOffset += DaystoAdd;
function offsettheDate (offsetCurrentDay) {
if (offsetCurrentDay > 6) {
offsetCurrentDay -= 6;
DayOffset = TodaysDay[offsetCurrentDay-1];
offsettheDate(offsetCurrentDay-1);
}
else {
DayOffset = TodaysDay[offsetCurrentDay];
return true;
}
}
offsettheDate(DayOffset);TheDate = DayOffset + ', ';
TheDate += month + ' ';
TheDate += currentDay + ', ';
if (CurrentYear<100) CurrentYear="19" + CurrentYear; TheDate +=
CurrentYear; document.write(' '+TheDate); }
//Then just call the function at the point you want the date to display, like
so:
dispDate(0)
//The number in the brackets is the number of days you want to add to the
current date.
Thanks in advance
|
For the LiveCycle Designer form:
Far to complex.
In FormCalc with a formatted date field of "MMM DD, YYYY" the
calculation script:
$.formattedValue = Num2Date(Date + 2, "MMM DD, YYYY")
For JavaScript:
var oExpire = new Date(new Date().valueOf() + (2 * 24 * 60 * 60 * 1000)); //
today's date plus 2 days in milliseconds
$.formattedValue = util.printd("MMM DD, YYYY", oExpire, true); //
formatted expiration date
or for HTML, Acrobat AcorForm, or LiveCycle Designer a funciton to advance
today's date by a passed number of days:
function ExpireDate(fNumDays) {
var Now = new Date(); // get today's date time object
var nFullYear = Now.getFullYear(); // get the full year from the object
var nMonth = Now.getMonth(); // get the month from the object
var nDate = Now.getDate(); // get the date from the object
return new Date(nFullYear, nMonth, nDate + 2); // return date time object
advanced by fNumDays
|