Home AMX User Forum NetLinx Studio

Day of the week?

What is the most efficient way of determining the day of the week given the date? If you had to write a NetLinx function to do something based on what day of the week it was, what would you do?

Comments

  • Netlinx has a built in function for determining day based on date:
    DAY_OF_WEEK
    Returns the day of the week for the specified date.

    Syntax:

    SINTEGER DAY_OF_WEEK (CHAR LDATE[ ])

    Parameters:

    LDATE - string containing the date in mm/dd/yyyy format.

    Result:

    Integer representing the day of the week (1 = Sunday, 2 = Monday, etc.).

    Example:

    nDAY = DAY_OF_WEEK ('2/13/1999') // nDAY = 7 (Saturday)

    Toss a comparator using the above function into a timeline that repeats every day and if the day is a match, call your function.

    --John
  • mpullinmpullin Posts: 949
    Huh. Dunno how I missed that one. Thanks!
Sign In or Register to comment.