Forum Home › Forums › Understanding the Software › To display exact Time And Date of Event occur
- This topic has 11 replies, 4 voices, and was last updated 3 years, 10 months ago by
Mikhail.
-
AuthorPosts
-
February 28, 2019 at 4:12 am #5085
mitesh
ParticipantHi Mikhail,
I want to Display the exact date and time when event occurs. In Administrator i have selected channel type as hourly real. i am getting wrong date (30/12/1899) and time (00.00.00). Please help me to display exact date and time.
Ex: Event: High Temperature : 70°C
Date of Event Occur: 27/02/2019
Time of Event Occur : 10:35:40Thank you.
February 28, 2019 at 4:28 pm #5089
MikhailModeratorHi,
For example to display current time, set input channel type to Real and formula to
EncodeDate(DateTime.Now)and format to Date and Time.How to display time of event, I’m not sure. Probably you need a custom module that catches events and copy their time stamps to an input channel.
March 5, 2019 at 4:32 am #5114mitesh
ParticipantHi Mikhail,
I am not getting anything after setting input channel type to Real and formula to EncodeDate(DateTime.Now) and format to Date and Time.
Thank you.
March 5, 2019 at 2:36 pm #5123
MikhailModeratorHi,
Please provide screenshots and logs.March 8, 2019 at 11:37 am #5149
HoracioParticipantHello Mikhail
I am trying to display Date and Time.
I set up an input channel for this type Real, formula EncodeDate(DateTime.Now) and format Date and Time. Please see image of Administrator:https://www.dropbox.com/s/mwhq8cc0vuwblzj/Trying%20to%20show%20Date%20and%20Time.docx?dl=0
I included a Dynamic Text with Scheme and assigned it to the corresponding input channel. I only get: “—“.
Am I missing something?
Thank you
March 8, 2019 at 3:55 pm #5151
MikhailModeratorHi,
Switch channel type to Calculated Real and remove Signal.March 9, 2019 at 12:02 am #5154
HoracioParticipantThank you very much! It worked ot fine.
January 9, 2022 at 3:38 am #9871myscada
ParticipantHi Mikhail,
Is it possible to display the DayOfWeek? I tried EncodeDate(DateTime.DayOfWeek) but it prompts “invalid argument”. It seems that enum constants cannot be converted to double ones.
January 9, 2022 at 7:47 am #9872myscada
ParticipantHi Mikhail,
I solved it based on your previous example. The return value 0-6 represents Sunday – Saturday. THX
int CheckDayOfWeek()
{
DateTime nowDT = DateTime.Now;
return (int)nowDT.DayOfWeek;
}January 9, 2022 at 9:44 am #9875
MikhailModeratorGood, thank you for the solution 🙂
January 9, 2022 at 10:52 am #9876myscada
ParticipantHi Mikhail,
According to your post
LinkI creat my own unit in the Units table, and then an input channel (calculated real) with the format “Enum text” and my own unit. Now the string value of DayOfWeek is displayed perfectly on the web page. THX a lot.
-
This reply was modified 3 years, 10 months ago by
Mikhail.
January 10, 2022 at 9:43 am #9880
MikhailModeratorYou are welcome.
-
This reply was modified 3 years, 10 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.