#

# LogiView

## Function 'weekday'

| This function returns the day of the week for a certain date. Monday is defined as "1", Sunday is defined as "7".
| ### Syntax:
| {INT_VAR}= weekday({DAT_EXPR})
| ### I/O parameters:
| {DAT_EXPR} | Date
| - |
| ### Return value:
| {INT_VAR} | Day (1=Monday)
| ### Example:
| Declaration of Variables
     10 DOCU_STRING_1 = date()
     20 DOCU_INT_1 = weekday(DOCU_STRING_1)
     30 if ( DOCU_INT_1==1)
     40   DOCU_STRING_2 = "Monday"
     50 elseif ( DOCU_INT_1==2 )
     60   DOCU_STRING_2 = "Tuesday"
     70 elseif ( DOCU_INT_1==3 )
     80   DOCU_STRING_2 = "Wednesday"
     90 elseif ( DOCU_INT_1==4 )
    100   DOCU_STRING_2 = "Thursday"
    110 elseif ( DOCU_INT_1==5 )
    120   DOCU_STRING_2 = "Friday"
    130 else
    140   DOCU_STRING_2 = "Weekend"
    150   endif
    170 put(strcat("Today is ",DOCU_STRING_1,".
                          It is ",DOCU_STRING_2,"."))
| Result:
| Functions and commands: Date and Time