Subtracting 2 dates to get days difference 追蹤

0
Avatar
Mark Adamson

Hello,

I've got 2 dates - UseBy & DepotDate.

By subtracting the 2 dates I have calculated the product shelf life which i need for the label.

I use the vb below and with the dates formatted as dd/mm/yy I get a script error. The only way I can get it to work is if I convert the dates to Julien date. 

However that will trip over when we start 2021 as depot date maybe in 2020 and the use by in 2021

Format.NamedSubStrings("UseBy").Value - Format.NamedSubStrings("DepotDate").Value

How can i get around this?

2 意見

0
Avatar
Pete Thane
評論操作 永久連結

Hi,

 

You need to use the DateDiff command as per the image below

 

0
Avatar
Mark Adamson
評論操作 永久連結

Thanks Pete,

 

that's brilliant. Thanks for your help.

 

登入寫評論。