11/20/2020 1:11 PM | |
Joined: 9/23/2005 Last visit: 1/24/2025 Posts: 4397 Rating: (1464)
|
Hi, “Simple Samples” are small projects that demonstrate simple features. The target is giving a quick overview about the theme and be used as start point for related discussions. Follow there are a short description and the configuration main steps. Sometimes it is necessary to read / work with clock, date and time. This Simple Sample shows how to read the system clock and convert the Date Time format to its individual components, to strings, to Miliseconds or to UTC format. TIPs:
References: the follow sites shows references and code to work with date and time:` (Thanks to Nina Froehlich - Technical Support Germany for the reference). Project (archived / ziped) Attachmentclock2.zip (2704 Downloads) |
Last edited by: Denilson Pegaia at: 11/20/2020 14:02:36Denilson Pegaia |
|
This contribution was helpful to9 thankful Users |
8/11/2022 4:15 PM | |
Joined: 3/24/2021 Last visit: 12/25/2024 Posts: 2 Rating: (0) |
Hi Denilson, Could you make a Tutorial of how to make the time zone correction? |
7/3/2024 5:07 AM | |
Joined: 1/21/2013 Last visit: 1/24/2025 Posts: 3462 Rating: (543)
|
Hi,
Since your problem description is not very detailed, a possible description would be that your device (panel or PC with WinCC Unified RT) is set to a time zone other than UTC and you have not specified a time zone in the options parameter of toLocaleString. Kind regards |
12/4/2024 10:24 AM | |
Joined: 9/15/2021 Last visit: 1/21/2025 Posts: 4 Rating: (0) |
In case it still helps: Time created by the 'new Date()' constructor generally stores the UTC-time. The left field (DateTime (UTC)) displays exactly that and the value of the right field (DateTime (as string)) is created by using .toLocaleString() where JS considers the time zone and daylight savings. Therefore +2h is perfectly correct. To display the same date/time in the right field you have to change the script at its 'Read Now' button from myDate.toLocaleString() to myDate.toString() or myDate.toUTCString() or something else (see Date() constructor). |
Follow us on