Weekday variable?

  • Hi,


    Im working on a projcet where we will do some automatic updates of the KUKA program. And in that case i need to know what weekday it is to secure that the update dosent take place in the weekends and fridays.


    $date dosent work as it dont give me the weekday or week no.


    So i need a way to get ether the weekday or week no.


    Any ideas?:winking_face:


    Info:

    KRC4

    KSS 8.3 and up.

  • Either use $date and use an algorithm to figure out the day of week. Or save 2020-01-01 weekday and find the remainder between then and $date (don't forget leap years).

    For the former, there are plenty of algorithms that you just have to implement in KRL.

  • Hi,


    Thanks for the reply. Already thougt of that. But where hoping for a more simple solution.

    I just need to start coding :winking_face:


    Had the idea that it might where possible to grasp it from windows. But thats where my programming skills gets tested:upside_down_face:

  • Hi panic mode,


    Really appriciate you help.. But it seems like some og the code i missing in your last post? or maybe i just dont get it......


    It seems like there is a funktion missing for Get_Day_Name

    And just to save time:

    Log and mod what are they declared as.


    Thanks in advance :winking_face:


    This i what i have so far.

  • I guess Get day name is just a switch statement that returns week days as words instead of integers (e.g GetDayName(3) ->Wednesday).

    Mod most likely returns the remainder of integer division.

  • 1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • you can just use MSGNOTIFY() instead of LOG()



    background:


    i did like that MsgLib is included as a standard feature but... i find it ... quite crude... specially the dialog. so i made my own substitutes....


    they are shorter to type,

    they make sure that displayed message or dialog are also recorded in the message database (for whatever reason MSGLIB does not do that)

    can have more parameters,

    different type parameters supported,

    controlled parameter format/precision,

    no more counting commas - one string contains all SK in expected order - left to right (no more reversed order for SK),

    number of SK to be displayed is automatically generated from that string and

    much more...



    For example day of thee week can be questioned and evaluated as easy as:


    DECL INT d

    LOOP

    d = DLG("Pick a day","Mon|Tue|Wed|Thu|Fri|Sat|Sun")

    LOG ("You pressed button %1 which is %2", d, Get_Day_Name(d))

    ENDLOOP

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

Advertising from our partners