FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important
information on the platform change.
07-13-2023 02:27 PM - edited 07-13-2023 02:31 PM
Hello,
I'm trying to retrieve the weekday name or number from a date.
For now I can get the current date and time and extract the time of day. But I would also like to know the name or number of the day, to be able to trigger different actions during the week or the weekend.
I have already tried several solutions (formulas with modulo) or several libraries but either the day is not correct or I get an error.
for example: with this code: DayIndex := DTU.GetDayOfWeek(dtDate:=CurentDate , peError:=dateError );
I get this error:
Can anybody help me?
PS: where does the value retrieved by the function: SysTimeRtcGet come from? Is there a way to sync it to the server time? there is a 7 minute difference between the 2
Thanks,
Kevin
Solved! Go to Solution.
07-13-2023 04:35 PM
Hi Kevin,
I was able to get the correct day of the week using the attached application.
Libraries required:
The error in your image is not a build error, but rather the hardware version in your PLC project does not match the target device. For example, if you are using a ctrlX CORE x3 running PLC 1.20, you should be specifying ctrlX CORE ARM64 1.20 in your PLC project.
The value returned from SysTimeRtcGet is from the ctrlX CORE real time clock. I confirmed this by changing the date of my ctrlX CORE and the weekday returned in the PLC matched.
What do you mean sync to server time? What is the server? If you assign your browser time to the ctrlX CORE, these should line up. You could also sync to NTP server.
07-19-2023 10:03 PM - edited 07-19-2023 11:04 PM
Hi Sgilk,
Thanks a lor for your reply !
I'm not at all familiar with the library versions or the CtrlX Core version.
I tried to open your application but I get the following errors:
If I press Ignore, I get this :
and since I installed the libraries you recommend,
I get errors in my project when I compile:
I've try to follow this tuto : https://developer.community.boschrexroth.com/t5/Store-and-How-to/Update-and-setup-ctrlX-CORE-with-a-...
but I can't acces the collaboration room
Can you help me to update properly?
I've try other solution from internet like this :
but RTS_SYSTIMEDATE is empty
EDIT : I manage to get the Weekday with this formula :
I would still like some help with the update 🙂
Thanks,
Kevin
07-20-2023 08:26 AM
Fastest way of updating is to use a system image to go to the version you like. That is also the recommended way updating from 1.12 to 1.20. See our online documentation how to do so.
General information about versioning see "Release cycle of apps and engineering software".
Information about accessing the ctrlX STORE are in the collaboration room see "FAQ for ctrlX Store".