Forum Home › Forums › Uncategorized Issues › Time string format and Locale
- This topic has 10 replies, 3 voices, and was last updated 3 months ago by
manjey73.
-
AuthorPosts
-
June 26, 2025 at 8:05 am #16511
JW
ParticipantSCADA V6, deplored on Win10 PC, simplified Chinese (zh-CN)
In default language en-GB, the displayed time string format (on table view and dynamic text on scheme) is HH:mm (e.g. 13:30)
I applied a language pack zh-Hans, the displayed time string format becomes tt H:mm (e.g. 下午 1:30, PM 1:30)
I tried the following tests:
1. change the format on windows, but the displayed time string format doesn’t seem to change with the OS format setting. Sitll being tt H:mm.
2. I changed the language pack file name and locale info to zh-CN to match the Win10 locale name. Then change the format again. But the time string format doesn’t change with the OS either. Sitll being tt H:mm.
3. I tried deploying the same project and language pack zh-CN on a Win11 PC simplified Chinese (zh-CN), the time string format is HH:mm. But also not change with OS format setting.
Questions
Is displayed time string format determined by the language pack, locale setting, OS setting or all of them?
How to config the displayed time string format properly?
June 26, 2025 at 11:07 am #16516Mikhail
ModeratorJune 26, 2025 at 11:08 am #16517Mikhail
ModeratorProbably, the simplest approach is changing the Format table (edit existing or add new format). Possible format strings are here.
June 26, 2025 at 12:03 pm #16518JW
ParticipantThanks Mikhail.
So the format is based on both the format identifier and culture name.
For the Input channels, Editing the formats works display as the method you said and the link your provided.
But for the time of the table view column, and the datetime on the event table, how can I force the format of them? They are now changed with culture name but not the format table.
How can I force the table view column to be HH:mm and the event table datetime to be yyyy/MM/dd HH:mm:ss?
June 27, 2025 at 11:25 am #16528Mikhail
ModeratorI suppose, the following should work:
In the Formats table, find the row with ID=33. Set the Format field of that row to HH:mm:ss. Use the format with ID=33 for the channel.
Does it work? If no, I can research by debugging.June 27, 2025 at 1:21 pm #16529JW
ParticipantThe channel format works as your instruction.
But the column name from 00:00 to 23:00 in HH:mm, changed to AM 12:00 to PM 11:00 in “tt h:mm” when I set the culture to “zh-CN” on a win10 PC, and couldn’t get it displayed as 00:00 to 23:00 “HH:mm”.
I added a datetime channel to a table view for comparison, the format of the channel value changed, but the “Column name” remains.
https://1drv.ms/i/c/7d196e63b671ad1b/Ecgl1GNclGJCmMjWyu4dMvoBC4Y7Y2EEH-VBKXB0ZNt88Q?e=KUFT40
June 30, 2025 at 11:21 am #16538Mikhail
ModeratorJuly 1, 2025 at 2:08 am #16547JW
ParticipantI am considering 2 ways to change this format.
1. Modified this line of code, re-compile the PlgMain.dll
2. Is the any method to alter the default shorttime format of zh-CN globally (system / scada level).
July 1, 2025 at 5:21 am #16548manjey73
ParticipantIn theory, it can be displayed on a diagram or table in a string format as you like through the Calculated channel using scripts.
Without touching the dll assembly. The channel cell stores a double representation of the time DateTime.ToOADate(). How you convert it to a DateTime and then to a string doesn’t matter.
-
This reply was modified 3 months ago by
manjey73.
July 1, 2025 at 1:39 pm #16554Mikhail
Moderator> Is the any method to alter the default shorttime format of zh-CN globally (system / scada level).
I suppose, it’s hardcoded somewhere in .NET framework.
July 1, 2025 at 1:46 pm #16556manjey73
ParticipantIt’s not exactly rigid, there are default options for a short date for different languages, but you can apply your own format and output it as a string.
https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings
You can also create your own short format.
-
This reply was modified 3 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.