Model.dateTime

Model.dateTime

miyeDP27D
Contributor Contributor
188 Views
5 Replies
Message 1 of 6

Model.dateTime

miyeDP27D
Contributor
Contributor

Hi, I have a question. I set a label on my token called "ReadyTime" and the value is Mode.dateTime. I was expecting it to give me the date and time as I would see in my statistic collector but it does not, it instead gave me a bunch of numbers. How can I fix this? 

0 Likes
189 Views
5 Replies
Replies (5)
Message 2 of 6

Paula_LG
Advocate
Advocate

Hi,

I suggest you take a look at the documentation for the DateTime class, since there's a lot you can accomplish with the properties and methods explained there: https://docs.flexsim.com/en/25.0/Reference/CodingInFlexSim/FlexScriptAPIReference/Data/DateTime.html...

I think maybe the toString() method is what you're looking for.

I hope it helps!

Message 3 of 6

miyeDP27D
Contributor
Contributor

Hi, I tried using Model.dateTime.toString() and when I use statistic collector to retrieve this information on my label, the date is not reflective of the actual date.

0 Likes
Message 4 of 6

Paula_LG
Advocate
Advocate

It is difficult to know what's going on without taking a look at your model or at least having more detail about what you're expecting and what you're getting instead.

The label on the token will reflect the dateTime for the simulation time on which the label was created. This string has a default format (according to your model settings), but it can be changed if needed.

Please, let me know how I can help you further.

0 Likes
Message 5 of 6

miyeDP27D
Contributor
Contributor

apologies, I may have not been clear. I have a token with a label called ReadyTime and it is valued as Model.dateTime and they are used in a internal list and also in a statistic collector but what I see in the two different platform is different, please see pic. The ReadyTime label pushed to a  list becomes only a number format while the statistic collector stayed as it is with the date and Time. how do I make change in a way that the list will also show in date and time? 

miyeDP27D_0-1749546993459.png

 

0 Likes
Message 6 of 6

Paula_LG
Advocate
Advocate

You could either:

  • Save the label value directly as a string, using Model.dateTime.toString() when the label is assigned. This way, the list will show the date and time without making any changes and you will have to change the Storage Type on the statistics collector to a string type.
  • Keep the label as Model.dateTime and the statistics collector as it is already configured, and change the list field from a label to an expression, where that expression should be DateTime(value.ReadyTime).toString()

I attach a dummy model for further clarification about the steps.

 

0 Likes