Difference between revisions of "DATE CDOW()"

From Lianjapedia
Jump to: navigation, search
(EXAMPLE)
 
m (Text replace - "lianjaapi.h" to "lianja_api.h")
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
 
==SYNOPSIS==
 
==SYNOPSIS==
 
<code lang="c">
 
<code lang="c">
#include "lianjaapi.h"
+
#include "lianja_api.h"
  
 
char *DATE_CDOW(date)
 
char *DATE_CDOW(date)
Line 25: Line 25:
  
 
<code lang="c">
 
<code lang="c">
#include "lianjaapi.h"
+
#include "lianja_api.h"
  
 
lianjaapi_date_cdow()
 
lianjaapi_date_cdow()

Latest revision as of 06:47, 11 April 2013

PURPOSE

Return character day of the week

SYNONYM

api_date_cdow()

SYNOPSIS

#include "lianja_api.h"
 
char	*DATE_CDOW(date)
 
<input parameters>
unsigned long	date;		/* date		*/
 
<output parameters>
none

DESCRIPTION

The DATE_CDOW() function will return the name of the day of the week from the specified date as a character string. The name is returned as a proper noun.

EXAMPLE

The following example returns "Weekend" if Saturday or Sunday is returned, otherwise "Workday" is returned.

#include "lianja_api.h"
 
lianjaapi_date_cdow()
{
    char		day_type[8];
    char		*day_week;
    unsigned long	date;
 
    if (_parinfo(1) != API_DTYPE) {
       _retc("");
    }
    date = DATE_STOD(_pards(1) );
    day_week = DATE_CDOW(date);
    if (strcmp(day_week, "Sunday") == 0 || strcmp(day_week, "Saturday") == 0 )
       strcpy(day_type, "Weekend");
    else
       strcpy(day_type, "Workday");
 
    _retc(day_type);
}

SEE ALSO

_parinfa(), _parinfo(), _pards(), _retds(), ISDATE(), DATE_AMPM(), DATE_CMONTH(), DATE_CTOD(), DATE_DATE(), DATE_DAY(), DATE_DOW(), DATE_DTOC(), DATE_DTOS(), DATE_MONTH(), DATE_STOD(), DATE_TIME(), DATE_YEAR()