Modern Postcard Posted December 9, 2011 Share Posted December 9, 2011 New to Javascript. Trying to create script for a future expiration date with 3 date fields. Client chooses expiration date - Have a drop down for the month, drop down for the day and a single line field for the year. How do I combine them to create an install by date that is 30 days from the date they enter? Thanks in advance Link to comment Share on other sites More sharing options...
esmith Posted December 12, 2011 Share Posted December 12, 2011 var myDate=new Date(); // Field("Month") should return month number 0-11 myDate.setFullYear(Field("Year"),Field("Month"),Field("Day")); myDate.setDate(myDate.getDate()+30); return myDate; Link to comment Share on other sites More sharing options...
Modern Postcard Posted December 12, 2011 Author Share Posted December 12, 2011 Ok So it's working but how do I get to look like "January 14, 2012" instead of "Jan 14 2012 09:13:21 GMT-0800" Link to comment Share on other sites More sharing options...
ThomasLewis Posted December 12, 2011 Share Posted December 12, 2011 The easiest way is to use FusionPro's built in fuction for formatting dates. Change the return line to be: return FormatDate(myDate, "lm d, yyyy"); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.