calculate the difference between two date

calculate the difference between two date

sherry_x
Not applicable
23 Views
2 Replies
Message 1 of 3

calculate the difference between two date

sherry_x
Not applicable

[ FlexSim 21.2.4 ]

I have a table as follow, AAA and BBB are number type. I want to calculate the difference between the values in the AAA and BBB columns, with the unit in days,and write the number of days into the CCC column.

What should I do? Thank you2024-11-20-13-26-08-flexsim-2021.png

0 Likes
Accepted solutions (1)
24 Views
2 Replies
Replies (2)
Message 2 of 3

moehlmann_fe
Observer
Observer
Accepted solution

First convert the number to a string, which you then use to create a DateTime representation of the date. These can be subtracted from each other and converted to days (datetime is the number of seconds since 01.01.1601, so to convert to days, divide by 86400).

To successfully convert to the datetime class, you have to add a delimiter between the year, month and day. Otherwise the program will interpret the first 1 of 11 to mean "January" and assume the rest is the day, leading to an error.

If you import the dates in another format the conversion might become easier.

date-conversion.fsm

0 Likes
Message 3 of 3

sherry_x
Not applicable

thank you~~~~~~~

0 Likes