Jump to content

Comparing Dates


Admin1676454018

Recommended Posts

Copy and paste everything below this line

 

 

 

 

// If you are building a coupon that has an expiration date, you

// want to make sure that today's date is before the coupon's

// start date and before the end of the coupon's expiration. The

// following rule checks the start and end dates of the coupon against

// today's date. There are two fields in your data, "CouponStart" and "CouponEnd".

date1 = DateFromString(Today());

date2 = DateFromString(Field("CouponStart");

date3 = DateFromString(Field("CouponEnd");

if (date3 > date1 && date2 > date1)

return "Expires: " + Field("CouponEnd");

else

return "Invalid Start or End Date";

 

 

//You can also check to see if the start date is after the end date:

date1 = DateFromString(Field("CouponStart");

date2 = DateFromString(Field("CouponEnd");

if (date2 < date3)

return "Expires: " + Field("CouponEnd");

else

return '<color name="Red">Error: End Date is earlier than Start Date';

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...