Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#include <time.h>
/*
* Returns 1 if this is the first weekday of the month.
*/
int main( void )
{
struct tm tms;
time_t t = time(NULL);
localtime_r( &t, &tms );
switch ( tms.tm_mday )
{
case 1:
if ( tms.tm_wday > 0 && tms.tm_wday < 6 )
return 1;
case 2:
case 3:
if ( tms.tm_wday == 1 )
return 1;
}
return 0;
}
cc -o som som.c
#!/bin/sh
DAYNUM=`date +%e`
WEEKDAY=`date +%u`
if [ $DAYNUM -eq 1 -a $WEEKDAY -le 5 -o $DAYNUM -le 3 -a $WEEKDAY -eq 1 ] ; then
echo "This is the first weekday of this month"
fi