Jump to content

Return future date from text with year first


mokamilk

Recommended Posts

Posted

I have a field formatted as text with the year coming first, like so:

 

20110914

 

I need it to look like this:

 

09/14/11

 

Then I also need to calculate a date 60 days from that field to use as an expiration date.

 

Any help would be greatly appreciated.

 

Thanks!

 

I'm using Mac OSX 10.5.8, Acrobat 9.3.1, and FusionPro 7.1.

Posted
I have a field formatted as text with the year coming first, like so:

 

20110914

 

I need it to look like this:

 

09/14/11

var s = Field("MyDateField");
var myDate = new Date(s.substr(0,4), parseInt(s.substr(4,2), 10)-1, s.substr(6,2));
return FormatDate(myDate, "mm/dd/yy");

Then I also need to calculate a date 60 days from that field to use as an expiration date.

var s = Field("MyDateField");
var myDate = new Date(s.substr(0,4), parseInt(s.substr(4,2), 10)-1, s.substr(6,2));
myDate.setDate(myDate.getDate() + 60);
return FormatDate(myDate, "mm/dd/yy");

Archived

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

×
×
  • Create New...