question

Matheus Coelho avatar image
1 Like"
Matheus Coelho asked Matheus Coelho commented

Model.dateTime.toString not working on march

Hello, i'm trying to use the function Model.dateTime.toString("%B"), and it's working correctly in almost all months, except march. Is there another way to return the name of the month?

1657305673529.png

1657305688232.png

FlexSim 22.1.2
modeldatetimetostring
1657305673529.png (12.4 KiB)
1657305688232.png (12.2 KiB)
· 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.

Jacob Gillespie avatar image Jacob Gillespie ♦ commented ·

It could have something to do with your system being in Portuguese. March prints correctly for me in English. Maybe you could try using:

Model.dateTime.toString("%#x")

That prints out the long format of the date. If that works you could parse it out.

0 Likes 0 ·

1 Answer

·
Matheus Coelho avatar image
0 Likes"
Matheus Coelho answered Matheus Coelho commented

1657562635942.png

In portuguese, it still returning a shorthand value of month 3. I think its because "March" in portuguese is "Março". The "ç" probably is causing this inconsistence. But thanks for your answer.


1657562635942.png (7.3 KiB)
· 2
5 |100000

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

Jacob Gillespie avatar image Jacob Gillespie ♦ commented ·

You are right the problem is the "ç" character. This is a bug in the toString() method that we will get fixed.

In the meantime you can do something like this:

int month = Model.dateTime.month;
string monthString;

if (month == 3) {
monthString = "março";
}
else {
monthString = Model.dateTime.toString("%B");
}

return monthString;


1 Like 1 ·
Matheus Coelho avatar image Matheus Coelho Jacob Gillespie ♦ commented ·

Thanks for help Jacob!

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.