274
274
, uint32_t minute
275
275
, uint32_t second);
278
* I don't like using these defines, but probably good to keep in sync
279
* with MySQL's week mode stuff..
281
#define DRIZZLE_WEEK_MODE_MONDAY_FIRST_DAY 1
282
#define DRIZZLE_WEEK_MODE_USE_ISO_8601_1988 2
283
#define DRIZZLE_WEEK_MODE_WEEK_RANGE_IS_ORDINAL 4
286
278
* Returns the number of the week from a supplied year, month, and
287
* date in the Gregorian proleptic calendar.
289
* The week number returned will depend on the values of the
290
* various boolean flags passed to the function.
292
* The flags influence returned values in the following ways:
294
* sunday_is_first_day_of_week
296
* If TRUE, Sunday is first day of week
297
* If FALSE, Monday is first day of week
299
* week_range_is_ordinal
301
* If FALSE, the week is in range 0-53
303
* Week 0 is returned for the the last week of the previous year (for
304
* a date at start of january) In this case one can get 53 for the
305
* first week of next year. This flag ensures that the week is
306
* relevant for the given year.
308
* If TRUE, the week is in range 1-53.
310
* In this case one may get week 53 for a date in January (when
311
* the week is that last week of previous year) and week 1 for a
316
* If TRUE, the weeks are numbered according to ISO 8601:1988
318
* ISO 8601:1988 means that if the week containing January 1 has
319
* four or more days in the new year, then it is week 1;
320
* Otherwise it is the last week of the previous year, and the
321
* next week is week 1.
323
* If FALSE, the week that contains the first 'first-day-of-week' is week 1.
279
* date in the Gregorian proleptic calendar. We use strftime() and
280
* the %U, %W, and %V format specifiers depending on the value
281
* of the sunday_is_first_day_of_week parameter.
325
283
* @param Subject year
326
284
* @param Subject month
327
285
* @param Subject day
328
286
* @param Is sunday the first day of the week?
329
* @param Is the week range ordinal?
330
* @param Should we use ISO 8601:1988 rules?
331
287
* @param Pointer to a uint32_t to hold the resulting year, which
332
288
* may be incremented or decremented depending on flags
334
290
uint32_t week_number_from_gregorian_date(uint32_t year
337
, bool sunday_is_first_day_of_week
338
, bool week_range_is_ordinal
339
, bool use_iso_8601_1988
340
, uint32_t *year_out);
293
, bool sunday_is_first_day_of_week);
296
* Returns the ISO week number of a supplied year, month, and
297
* date in the Gregorian proleptic calendar. We use strftime() and
298
* the %V format specifier to do the calculation, which yields a
299
* correct ISO 8601:1988 week number.
301
* The final year_out parameter is a pointer to an integer which will
302
* be set to the year in which the week belongs, according to ISO8601:1988,
303
* which may be different from the Gregorian calendar year.
305
* @see http://en.wikipedia.org/wiki/ISO_8601
307
* @param Subject year
308
* @param Subject month
310
* @param Pointer to a uint32_t to hold the resulting year, which
311
* may be incremented or decremented depending on flags
313
uint32_t iso_week_number_from_gregorian_date(uint32_t year
316
, uint32_t *year_out);
342
317
#ifdef __cplusplus