FreeBASIC  0.91.0
time_weekdayname.c
Go to the documentation of this file.
1 /* returns the weekday name */
2 
3 #include "fb.h"
4 
5 /*:::::*/
6 FBCALL FBSTRING *fb_WeekdayName( int weekday, int abbreviation, int first_day_of_week )
7 {
8  FBSTRING *res;
9 
10  if( weekday < 1 || weekday > 7 || first_day_of_week < 0 || first_day_of_week > 7 ) {
12  return &__fb_ctx.null_desc;
13  }
14 
16 
17  if( first_day_of_week==FB_WEEK_DAY_SYSTEM ) {
18  /* FIXME: Add query of system default */
19  first_day_of_week = FB_WEEK_DAY_DEFAULT;
20  }
21 
22  weekday += first_day_of_week - 1;
23  if( weekday > 7 )
24  weekday -= 7;
25 
26  res = fb_IntlGetWeekdayName( weekday, abbreviation, FALSE );
27  if( res==NULL ) {
29  res = &__fb_ctx.null_desc;
30  }
31 
32  return res;
33 }