question

anon-user avatar image
0 Likes"
anon-user asked anon-user commented

How to convert in dateTime formate?

Hi FlexSim Support Team,

Could you please let me how I can convert "25-04-2022 16:52" into FlexSim dateTtime formate?

I am trying it to convert using below method,

string TS= "25-04-2022 16:52";

DateTime Value= DateTime(TS, "%d-%m-%Y %I:%M:%S %p");

return Value;

But getting error i.e

exception: Error Constructing DateTime: Value not valid date string.

exception: FlexScript exception: <no path> c: <no path> i: <no path>


FlexSim 22.1.0
data type
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Jason Lightfoot avatar image
1 Like"
Jason Lightfoot answered anon-user commented
string TS= "25-04-2022 16:52";
DateTime Value= DateTime(TS, "%d-%m-%Y %H:%M");
return Value;


You had used %I which is the 12 hour clock but passed in 16 hours. Also you had the seconds in the format string and the am/pm indicator.

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

anon-user avatar image anon-user commented ·

Thanks, @Jason Lightfoot for quick support.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.