Date and time from excel is reading as string how to convert it to time

Date and time from excel is reading as string how to convert it to time

sudheer_r
Not applicable
9 Views
1 Reply
Message 1 of 2

Date and time from excel is reading as string how to convert it to time

sudheer_r
Not applicable

[ FlexSim 23.2.0 ]

Flexsim identifies below date and time for order generation as string how to convert below data as date and time.

And also is there a way to convert below time to simulation time using any query in flexsim.

1694198541484.png


0 Likes
Accepted solutions (1)
10 Views
1 Reply
Reply (1)
Message 2 of 2

Matthew_Gillespie
Autodesk
Autodesk
Accepted solution

To convert a string representation of a date and time you can use the DateTime constructor.

To get the simulation time you can subtract the model start time from that value and then convert that value to your model units. For example:

string timestamp = "03-04-2023 12:16";
DateTime dateTime = DateTime(timestamp, "%m-%d-%Y %H:%M");
DateTime modelTime =  dateTime - Model.startDateTime;
return modelTime.totalSeconds;


Matthew Gillespie
FlexSim Software Developer

0 Likes