WEEKDAY
 

The ARMmite, ARMweb, DINkit and SuperPRO have a provision to add a battery to keep these time functions running when power is removed.  That battery (ML2020) has to be installed by the user or can be special ordered for larger volume customers.

The BASICchip does not have RTC hardware.  The PROplus board does not have the RTC crystal installed.

Syntax


#include <RTC.bas>                  ' source in /Program Files/Coridium/BASIClib

FUNCTION WEEKDAY(value)     'When called with -1 the current value for WEEKDAY is returned.

Description


Function setting or returning the day of the week.

When called with zero or greater value, the WEEKDAY is changed.
0 corresponding to Sunday through 6 corresponding to Saturday

Example

#include <RTC.bas>
 '...
DIM dayname(15) as string
 '...
SECOND (30)
MINUTE (15)
HOUR (13)
DAY (14)
MONTH (4)
YEAR (2006)

SELECT WEEKDAY(-1)
CASE 0
   dayname = "Sunday"
CASE 1
   dayname = "Monday"
CASE 2
   dayname = "Tuesday"
CASE 3
   dayname = "Wednesday"
CASE 4
   dayname = "Thursday"
CASE 5
   dayname = "Friday"
CASE 6
   dayname = "Saturday"
CASE ELSE
   dayname = "not possible"
ENDSELECT

PRINT "This is "; dayname,  MONTH(0); "/"; DAY(0); "/"; YEAR(0), "at"; HOUR(-1); ":"; MINUTE(-1); ":"; SECOND(-1)
The output would look like:
This is Friday 4/14/2006 at 13:15:30