Subtract 59 Months From Date 追蹤

Legacy Poster

I have an expiration date (2020-09, this will vary) and I need to subtract 59 months to calculate the date of manufacturing. The format has to be yyyy-mm. I currently have the file setup to open with today's year and month and calculate expiration date by adding 5 years and subtracting 1 month, however this won't work for every instance. Is there a java script or VB Script to calculate the date of manufacturing. I'm using BarTender ver 9.4 on Windows 7. Any suggestions is greatly appreciated.

1 意見

Shotaro Ito
評論操作 永久連結

When you have expiration date in "Text 1", create a text and get data source from Object value (Label object string) of Text 1.

Apply  VB script from Transform (more options).


'Place this in OnProcessData Event'
'Input data is yyyy-MM format'
'Return 59 month before'

y = left(Value,4)
m = mid(Value,6,2)
expdate = DateSerial(y,m,1)
mfgdate = DateAdd("m",-59, expdate)
Value = Year(mfgdate) & "-" & Right("0" & Month(mfgdate), 2)