Library for working with DATE_AND_TIME (DT) variable

  • lubos

    lubos - 2019-05-10


    I have question, what is ideal way to manipulate with varible of DATE_AND_TIME (DT) type. I want to make Visu for changing RTC time on Raspberry. My system CODESYS V3.5 SP14 Patch2.

    I get time from system RTC clock with this function:
    UtcTime := SysTimeRtcGet(dummy);

    Now i need e.g. add one hour or one month and write UtcTime back to system with SysTimeRtcSet().

    I tried instal OSCAT library and use function HOUR_OF_DT, but compiler say: "HOUR_OF_DT not defined" . I don´t know why, only in manual is writen, that OSCAT support only 32bit system and my Raspberry 3B+ is 64bit.

    Is there some oficial system library to work easy with date and time?

    Thanks for info, Lubos.


    JAPIB - 2019-05-10

    You can find an example in the CODESYS STORE : Date and Time (

    About OSCAT be careful, OSCAT function blocks often use other OSCAT function blocks
    and, for date and time management, they use a Data type (from OSCAT lbrary) called CALENDAR.


  • lubos

    lubos - 2019-05-15

    Thank You JAPIB very much for helping me...
    I used Util.SplitDateTime function for conversion. I didn't know about UTIL before...

    Btw, is there some detailed documentation for standars 3S libraries? Only documentation, what i can find is short description of functions in Library Manager, but it is not sometimes enought
    The only source of library description find i on this forum in question, but is somewhere oficial LIBRARY DOCU to easy find?


    JAPIB - 2019-05-15


    You can have a look on the internet site 'CODESYS Help', for example here : ... n=
    I think it's the simplest and most up-to-date.

    Otherwise there is some help files (Standard.chm, Util.chm, ...) installed on your PC during the installation of CODESYS.
    You can find it on :
    C:/Program files/CODESYS 3.5.../CODESYS/Online Help/En

    You must use 'Program files' with CODESYS V3.5 64 bits ou 'Program files (x86)' with CODESYS V3.5 16 bits.
    (Access paths correspond to a use of Windows 7, with other versions it may be different )



Log in to post a comment.