TIA Portal: Unified Comfort Panel: How to add Local Date and Time with Script
The simplest way to show your date and time in your Unified Comfort Panel is just writing one line of code. 1- Create “Text Box” Create two “Text Box” from the toolbox, one for the date and one for the time. 2. Add “Script” property your Text Click on the Text Box > Go to its properties > Next to “Text” select “Script” from dropdown menu. If you don´t see script page on the right side, click small arrow to the left and open the script area. 3. Write your Magic Script To show the Date just add the following code, declaring your region for example: ´de-DE´ for Germany. For Local Date: value = new Date().toLocaleDateString('de-DE'); For Local Time: value = new Date().toLocaleTimeString('de-DE'); For your region, just check “ ISO Language Code Table” under this link: Language Code Table (lingoes.net) If the Time or Date is Displayed Wrong What if Unified Panel does not show the right time that you expected? There could be time difference because of your settings. ...