This should work if you have the year, month and day:
#include <time.h> // struct tm, etc are defined here
void GetDay(void)
{
// Set up a variable of type struct tm and a pointer to it
struct tm ts, *t=&ts;
// this will contain the calendar date in seconds
time_t ct;
// local variables
int year, month, day, weekday;
// Example: 16 December 2004
Year = 2004 - 1900; // years since 1900
Month = 11; // January = 0, February = 1, etc
Day = 16; // The first day of the month is 1 (not 0)
// Zero out the tm structure
memset (t, 0, sizeof(struct tm));
// Set the year, month and day
t->tm_year = year;
t->tm_mon = month;
t->tm_mday = day;
// Get the calendar time
ct = mktime(t);
// Convert to component parts
t = gmtime(&ct);
// Add 1 to weekday for a value of 1 to 7
weekday = t->tm_wday + 1;
// weekday contains the day of the week
// 1 = Sunday through 7 = Saturday
}
If you want the current day use the function DateStr().
Regards,
George Hodgson
"gasma1975" <x@no.email> wrote in message news:169698@exchange.ni.com...
> Hi,<br><br>I'm using CVI 6.0 and WIN XP PRO SP2.<br><br>I need to get the
day of the WEEK, I've used the MSCAL (Active X calendar) but MSCAL will not
tell me if I'm monday...or any other day of the week. I took a look in the
CVI library and even in the DATE/TIME library nothing will tell me the day
of the WEEK. So is there a method to find out the current day of the WEEK
wich is a value 1-7 ?<br><br>Thank you,