1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module glib.Date;
26 
27 private import glib.ConstructionException;
28 private import glib.MemorySlice;
29 private import glib.Str;
30 private import glib.TimeVal;
31 private import glib.c.functions;
32 public  import glib.c.types;
33 public  import gtkc.glibtypes;
34 private import gtkd.Loader;
35 
36 
37 /**
38  * Represents a day between January 1, Year 1 and a few thousand years in
39  * the future. None of its members should be accessed directly.
40  * 
41  * If the #GDate-struct is obtained from g_date_new(), it will be safe
42  * to mutate but invalid and thus not safe for calendrical computations.
43  * 
44  * If it's declared on the stack, it will contain garbage so must be
45  * initialized with g_date_clear(). g_date_clear() makes the date invalid
46  * but sane. An invalid date doesn't represent a day, it's "empty." A date
47  * becomes valid after you set it to a Julian day or you set a day, month,
48  * and year.
49  */
50 public final class Date
51 {
52 	/** the main Gtk struct */
53 	protected GDate* gDate;
54 	protected bool ownedRef;
55 
56 	/** Get the main Gtk struct */
57 	public GDate* getDateStruct(bool transferOwnership = false)
58 	{
59 		if (transferOwnership)
60 			ownedRef = false;
61 		return gDate;
62 	}
63 
64 	/** the main Gtk struct as a void* */
65 	protected void* getStruct()
66 	{
67 		return cast(void*)gDate;
68 	}
69 
70 	/**
71 	 * Sets our main struct and passes it to the parent class.
72 	 */
73 	public this (GDate* gDate, bool ownedRef = false)
74 	{
75 		this.gDate = gDate;
76 		this.ownedRef = ownedRef;
77 	}
78 
79 	~this ()
80 	{
81 		if ( Linker.isLoaded(LIBRARY_GLIB) && ownedRef )
82 			g_date_free(gDate);
83 	}
84 
85 
86 	/**
87 	 * the Julian representation of the date
88 	 */
89 	public @property uint julianDays()
90 	{
91 		return gDate.julianDays;
92 	}
93 
94 	/** Ditto */
95 	public @property void julianDays(uint value)
96 	{
97 		gDate.julianDays = value;
98 	}
99 
100 	/**
101 	 * this bit is set if @julian_days is valid
102 	 */
103 	public @property uint julian()
104 	{
105 		return gDate.julian;
106 	}
107 
108 	/** Ditto */
109 	public @property void julian(uint value)
110 	{
111 		gDate.julian = value;
112 	}
113 
114 	/**
115 	 * this is set if @day, @month and @year are valid
116 	 */
117 	public @property uint dmy()
118 	{
119 		return gDate.dmy;
120 	}
121 
122 	/** Ditto */
123 	public @property void dmy(uint value)
124 	{
125 		gDate.dmy = value;
126 	}
127 
128 	/**
129 	 * the day of the day-month-year representation of the date,
130 	 * as a number between 1 and 31
131 	 */
132 	public @property uint day()
133 	{
134 		return gDate.day;
135 	}
136 
137 	/** Ditto */
138 	public @property void day(uint value)
139 	{
140 		gDate.day = value;
141 	}
142 
143 	/**
144 	 * the day of the day-month-year representation of the date,
145 	 * as a number between 1 and 12
146 	 */
147 	public @property uint month()
148 	{
149 		return gDate.month;
150 	}
151 
152 	/** Ditto */
153 	public @property void month(uint value)
154 	{
155 		gDate.month = value;
156 	}
157 
158 	/**
159 	 * the day of the day-month-year representation of the date
160 	 */
161 	public @property uint year()
162 	{
163 		return gDate.year;
164 	}
165 
166 	/** Ditto */
167 	public @property void year(uint value)
168 	{
169 		gDate.year = value;
170 	}
171 
172 	/**
173 	 * Allocates a #GDate and initializes
174 	 * it to a sane state. The new date will
175 	 * be cleared (as if you'd called g_date_clear()) but invalid (it won't
176 	 * represent an existing day). Free the return value with g_date_free().
177 	 *
178 	 * Returns: a newly-allocated #GDate
179 	 *
180 	 * Throws: ConstructionException GTK+ fails to create the object.
181 	 */
182 	public this()
183 	{
184 		auto __p = g_date_new();
185 
186 		if(__p is null)
187 		{
188 			throw new ConstructionException("null returned by new");
189 		}
190 
191 		this(cast(GDate*) __p);
192 	}
193 
194 	/**
195 	 * Like g_date_new(), but also sets the value of the date. Assuming the
196 	 * day-month-year triplet you pass in represents an existing day, the
197 	 * returned date will be valid.
198 	 *
199 	 * Params:
200 	 *     day = day of the month
201 	 *     month = month of the year
202 	 *     year = year
203 	 *
204 	 * Returns: a newly-allocated #GDate initialized with @day, @month, and @year
205 	 *
206 	 * Throws: ConstructionException GTK+ fails to create the object.
207 	 */
208 	public this(GDateDay day, GDateMonth month, GDateYear year)
209 	{
210 		auto __p = g_date_new_dmy(day, month, year);
211 
212 		if(__p is null)
213 		{
214 			throw new ConstructionException("null returned by new_dmy");
215 		}
216 
217 		this(cast(GDate*) __p);
218 	}
219 
220 	/**
221 	 * Like g_date_new(), but also sets the value of the date. Assuming the
222 	 * Julian day number you pass in is valid (greater than 0, less than an
223 	 * unreasonably large number), the returned date will be valid.
224 	 *
225 	 * Params:
226 	 *     julianDay = days since January 1, Year 1
227 	 *
228 	 * Returns: a newly-allocated #GDate initialized with @julian_day
229 	 *
230 	 * Throws: ConstructionException GTK+ fails to create the object.
231 	 */
232 	public this(uint julianDay)
233 	{
234 		auto __p = g_date_new_julian(julianDay);
235 
236 		if(__p is null)
237 		{
238 			throw new ConstructionException("null returned by new_julian");
239 		}
240 
241 		this(cast(GDate*) __p);
242 	}
243 
244 	/**
245 	 * Increments a date some number of days.
246 	 * To move forward by weeks, add weeks*7 days.
247 	 * The date must be valid.
248 	 *
249 	 * Params:
250 	 *     nDays = number of days to move the date forward
251 	 */
252 	public void addDays(uint nDays)
253 	{
254 		g_date_add_days(gDate, nDays);
255 	}
256 
257 	/**
258 	 * Increments a date by some number of months.
259 	 * If the day of the month is greater than 28,
260 	 * this routine may change the day of the month
261 	 * (because the destination month may not have
262 	 * the current day in it). The date must be valid.
263 	 *
264 	 * Params:
265 	 *     nMonths = number of months to move forward
266 	 */
267 	public void addMonths(uint nMonths)
268 	{
269 		g_date_add_months(gDate, nMonths);
270 	}
271 
272 	/**
273 	 * Increments a date by some number of years.
274 	 * If the date is February 29, and the destination
275 	 * year is not a leap year, the date will be changed
276 	 * to February 28. The date must be valid.
277 	 *
278 	 * Params:
279 	 *     nYears = number of years to move forward
280 	 */
281 	public void addYears(uint nYears)
282 	{
283 		g_date_add_years(gDate, nYears);
284 	}
285 
286 	/**
287 	 * If @date is prior to @min_date, sets @date equal to @min_date.
288 	 * If @date falls after @max_date, sets @date equal to @max_date.
289 	 * Otherwise, @date is unchanged.
290 	 * Either of @min_date and @max_date may be %NULL.
291 	 * All non-%NULL dates must be valid.
292 	 *
293 	 * Params:
294 	 *     minDate = minimum accepted value for @date
295 	 *     maxDate = maximum accepted value for @date
296 	 */
297 	public void clamp(Date minDate, Date maxDate)
298 	{
299 		g_date_clamp(gDate, (minDate is null) ? null : minDate.getDateStruct(), (maxDate is null) ? null : maxDate.getDateStruct());
300 	}
301 
302 	/**
303 	 * Initializes one or more #GDate structs to a sane but invalid
304 	 * state. The cleared dates will not represent an existing date, but will
305 	 * not contain garbage. Useful to init a date declared on the stack.
306 	 * Validity can be tested with g_date_valid().
307 	 *
308 	 * Params:
309 	 *     nDates = number of dates to clear
310 	 */
311 	public void clear(uint nDates)
312 	{
313 		g_date_clear(gDate, nDates);
314 	}
315 
316 	/**
317 	 * qsort()-style comparison function for dates.
318 	 * Both dates must be valid.
319 	 *
320 	 * Params:
321 	 *     rhs = second date to compare
322 	 *
323 	 * Returns: 0 for equal, less than zero if @lhs is less than @rhs,
324 	 *     greater than zero if @lhs is greater than @rhs
325 	 */
326 	public int compare(Date rhs)
327 	{
328 		return g_date_compare(gDate, (rhs is null) ? null : rhs.getDateStruct());
329 	}
330 
331 	/**
332 	 * Copies a GDate to a newly-allocated GDate. If the input was invalid
333 	 * (as determined by g_date_valid()), the invalid state will be copied
334 	 * as is into the new object.
335 	 *
336 	 * Returns: a newly-allocated #GDate initialized from @date
337 	 *
338 	 * Since: 2.56
339 	 */
340 	public Date copy()
341 	{
342 		auto __p = g_date_copy(gDate);
343 
344 		if(__p is null)
345 		{
346 			return null;
347 		}
348 
349 		return new Date(cast(GDate*) __p, true);
350 	}
351 
352 	/**
353 	 * Computes the number of days between two dates.
354 	 * If @date2 is prior to @date1, the returned value is negative.
355 	 * Both dates must be valid.
356 	 *
357 	 * Params:
358 	 *     date2 = the second date
359 	 *
360 	 * Returns: the number of days between @date1 and @date2
361 	 */
362 	public int daysBetween(Date date2)
363 	{
364 		return g_date_days_between(gDate, (date2 is null) ? null : date2.getDateStruct());
365 	}
366 
367 	/**
368 	 * Frees a #GDate returned from g_date_new().
369 	 */
370 	public void free()
371 	{
372 		g_date_free(gDate);
373 		ownedRef = false;
374 	}
375 
376 	/**
377 	 * Returns the day of the month. The date must be valid.
378 	 *
379 	 * Returns: day of the month
380 	 */
381 	public GDateDay getDay()
382 	{
383 		return g_date_get_day(gDate);
384 	}
385 
386 	/**
387 	 * Returns the day of the year, where Jan 1 is the first day of the
388 	 * year. The date must be valid.
389 	 *
390 	 * Returns: day of the year
391 	 */
392 	public uint getDayOfYear()
393 	{
394 		return g_date_get_day_of_year(gDate);
395 	}
396 
397 	/**
398 	 * Returns the week of the year, where weeks are interpreted according
399 	 * to ISO 8601.
400 	 *
401 	 * Returns: ISO 8601 week number of the year.
402 	 *
403 	 * Since: 2.6
404 	 */
405 	public uint getIso8601WeekOfYear()
406 	{
407 		return g_date_get_iso8601_week_of_year(gDate);
408 	}
409 
410 	/**
411 	 * Returns the Julian day or "serial number" of the #GDate. The
412 	 * Julian day is simply the number of days since January 1, Year 1; i.e.,
413 	 * January 1, Year 1 is Julian day 1; January 2, Year 1 is Julian day 2,
414 	 * etc. The date must be valid.
415 	 *
416 	 * Returns: Julian day
417 	 */
418 	public uint getJulian()
419 	{
420 		return g_date_get_julian(gDate);
421 	}
422 
423 	/**
424 	 * Returns the week of the year, where weeks are understood to start on
425 	 * Monday. If the date is before the first Monday of the year, return 0.
426 	 * The date must be valid.
427 	 *
428 	 * Returns: week of the year
429 	 */
430 	public uint getMondayWeekOfYear()
431 	{
432 		return g_date_get_monday_week_of_year(gDate);
433 	}
434 
435 	/**
436 	 * Returns the month of the year. The date must be valid.
437 	 *
438 	 * Returns: month of the year as a #GDateMonth
439 	 */
440 	public GDateMonth getMonth()
441 	{
442 		return g_date_get_month(gDate);
443 	}
444 
445 	/**
446 	 * Returns the week of the year during which this date falls, if
447 	 * weeks are understood to begin on Sunday. The date must be valid.
448 	 * Can return 0 if the day is before the first Sunday of the year.
449 	 *
450 	 * Returns: week number
451 	 */
452 	public uint getSundayWeekOfYear()
453 	{
454 		return g_date_get_sunday_week_of_year(gDate);
455 	}
456 
457 	/**
458 	 * Returns the day of the week for a #GDate. The date must be valid.
459 	 *
460 	 * Returns: day of the week as a #GDateWeekday.
461 	 */
462 	public GDateWeekday getWeekday()
463 	{
464 		return g_date_get_weekday(gDate);
465 	}
466 
467 	/**
468 	 * Returns the year of a #GDate. The date must be valid.
469 	 *
470 	 * Returns: year in which the date falls
471 	 */
472 	public GDateYear getYear()
473 	{
474 		return g_date_get_year(gDate);
475 	}
476 
477 	/**
478 	 * Returns %TRUE if the date is on the first of a month.
479 	 * The date must be valid.
480 	 *
481 	 * Returns: %TRUE if the date is the first of the month
482 	 */
483 	public bool isFirstOfMonth()
484 	{
485 		return g_date_is_first_of_month(gDate) != 0;
486 	}
487 
488 	/**
489 	 * Returns %TRUE if the date is the last day of the month.
490 	 * The date must be valid.
491 	 *
492 	 * Returns: %TRUE if the date is the last day of the month
493 	 */
494 	public bool isLastOfMonth()
495 	{
496 		return g_date_is_last_of_month(gDate) != 0;
497 	}
498 
499 	/**
500 	 * Checks if @date1 is less than or equal to @date2,
501 	 * and swap the values if this is not the case.
502 	 *
503 	 * Params:
504 	 *     date2 = the second date
505 	 */
506 	public void order(Date date2)
507 	{
508 		g_date_order(gDate, (date2 is null) ? null : date2.getDateStruct());
509 	}
510 
511 	/**
512 	 * Sets the day of the month for a #GDate. If the resulting
513 	 * day-month-year triplet is invalid, the date will be invalid.
514 	 *
515 	 * Params:
516 	 *     day = day to set
517 	 */
518 	public void setDay(GDateDay day)
519 	{
520 		g_date_set_day(gDate, day);
521 	}
522 
523 	/**
524 	 * Sets the value of a #GDate from a day, month, and year.
525 	 * The day-month-year triplet must be valid; if you aren't
526 	 * sure it is, call g_date_valid_dmy() to check before you
527 	 * set it.
528 	 *
529 	 * Params:
530 	 *     day = day
531 	 *     month = month
532 	 *     y = year
533 	 */
534 	public void setDmy(GDateDay day, GDateMonth month, GDateYear y)
535 	{
536 		g_date_set_dmy(gDate, day, month, y);
537 	}
538 
539 	/**
540 	 * Sets the value of a #GDate from a Julian day number.
541 	 *
542 	 * Params:
543 	 *     julianDate = Julian day number (days since January 1, Year 1)
544 	 */
545 	public void setJulian(uint julianDate)
546 	{
547 		g_date_set_julian(gDate, julianDate);
548 	}
549 
550 	/**
551 	 * Sets the month of the year for a #GDate.  If the resulting
552 	 * day-month-year triplet is invalid, the date will be invalid.
553 	 *
554 	 * Params:
555 	 *     month = month to set
556 	 */
557 	public void setMonth(GDateMonth month)
558 	{
559 		g_date_set_month(gDate, month);
560 	}
561 
562 	/**
563 	 * Parses a user-inputted string @str, and try to figure out what date it
564 	 * represents, taking the [current locale][setlocale] into account. If the
565 	 * string is successfully parsed, the date will be valid after the call.
566 	 * Otherwise, it will be invalid. You should check using g_date_valid()
567 	 * to see whether the parsing succeeded.
568 	 *
569 	 * This function is not appropriate for file formats and the like; it
570 	 * isn't very precise, and its exact behavior varies with the locale.
571 	 * It's intended to be a heuristic routine that guesses what the user
572 	 * means by a given string (and it does work pretty well in that
573 	 * capacity).
574 	 *
575 	 * Params:
576 	 *     str = string to parse
577 	 */
578 	public void setParse(string str)
579 	{
580 		g_date_set_parse(gDate, Str.toStringz(str));
581 	}
582 
583 	/**
584 	 * Sets the value of a date from a #GTime value.
585 	 * The time to date conversion is done using the user's current timezone.
586 	 *
587 	 * Deprecated: Use g_date_set_time_t() instead.
588 	 *
589 	 * Params:
590 	 *     time = #GTime value to set.
591 	 */
592 	public void setTime(GTime time)
593 	{
594 		g_date_set_time(gDate, time);
595 	}
596 
597 	/**
598 	 * Sets the value of a date to the date corresponding to a time
599 	 * specified as a time_t. The time to date conversion is done using
600 	 * the user's current timezone.
601 	 *
602 	 * To set the value of a date to the current day, you could write:
603 	 * |[<!-- language="C" -->
604 	 * time_t now = time (NULL);
605 	 * if (now == (time_t) -1)
606 	 * // handle the error
607 	 * g_date_set_time_t (date, now);
608 	 * ]|
609 	 *
610 	 * Params:
611 	 *     timet = time_t value to set
612 	 *
613 	 * Since: 2.10
614 	 */
615 	public void set_time_t(uint timet)
616 	{
617 		g_date_set_time_t(gDate, timet);
618 	}
619 
620 	/**
621 	 * Sets the value of a date from a #GTimeVal value.  Note that the
622 	 * @tv_usec member is ignored, because #GDate can't make use of the
623 	 * additional precision.
624 	 *
625 	 * The time to date conversion is done using the user's current timezone.
626 	 *
627 	 * Deprecated: #GTimeVal is not year-2038-safe. Use g_date_set_time_t()
628 	 * instead.
629 	 *
630 	 * Params:
631 	 *     timeval = #GTimeVal value to set
632 	 *
633 	 * Since: 2.10
634 	 */
635 	public void setTimeVal(TimeVal timeval)
636 	{
637 		g_date_set_time_val(gDate, (timeval is null) ? null : timeval.getTimeValStruct());
638 	}
639 
640 	/**
641 	 * Sets the year for a #GDate. If the resulting day-month-year
642 	 * triplet is invalid, the date will be invalid.
643 	 *
644 	 * Params:
645 	 *     year = year to set
646 	 */
647 	public void setYear(GDateYear year)
648 	{
649 		g_date_set_year(gDate, year);
650 	}
651 
652 	/**
653 	 * Moves a date some number of days into the past.
654 	 * To move by weeks, just move by weeks*7 days.
655 	 * The date must be valid.
656 	 *
657 	 * Params:
658 	 *     nDays = number of days to move
659 	 */
660 	public void subtractDays(uint nDays)
661 	{
662 		g_date_subtract_days(gDate, nDays);
663 	}
664 
665 	/**
666 	 * Moves a date some number of months into the past.
667 	 * If the current day of the month doesn't exist in
668 	 * the destination month, the day of the month
669 	 * may change. The date must be valid.
670 	 *
671 	 * Params:
672 	 *     nMonths = number of months to move
673 	 */
674 	public void subtractMonths(uint nMonths)
675 	{
676 		g_date_subtract_months(gDate, nMonths);
677 	}
678 
679 	/**
680 	 * Moves a date some number of years into the past.
681 	 * If the current day doesn't exist in the destination
682 	 * year (i.e. it's February 29 and you move to a non-leap-year)
683 	 * then the day is changed to February 29. The date
684 	 * must be valid.
685 	 *
686 	 * Params:
687 	 *     nYears = number of years to move
688 	 */
689 	public void subtractYears(uint nYears)
690 	{
691 		g_date_subtract_years(gDate, nYears);
692 	}
693 
694 	/**
695 	 * Fills in the date-related bits of a struct tm using the @date value.
696 	 * Initializes the non-date parts with something sane but meaningless.
697 	 *
698 	 * Params:
699 	 *     tm = struct tm to fill
700 	 */
701 	public void toStructTm(void* tm)
702 	{
703 		g_date_to_struct_tm(gDate, tm);
704 	}
705 
706 	/**
707 	 * Returns %TRUE if the #GDate represents an existing day. The date must not
708 	 * contain garbage; it should have been initialized with g_date_clear()
709 	 * if it wasn't allocated by one of the g_date_new() variants.
710 	 *
711 	 * Returns: Whether the date is valid
712 	 */
713 	public bool valid()
714 	{
715 		return g_date_valid(gDate) != 0;
716 	}
717 
718 	/**
719 	 * Returns the number of days in a month, taking leap
720 	 * years into account.
721 	 *
722 	 * Params:
723 	 *     month = month
724 	 *     year = year
725 	 *
726 	 * Returns: number of days in @month during the @year
727 	 */
728 	public static ubyte getDaysInMonth(GDateMonth month, GDateYear year)
729 	{
730 		return g_date_get_days_in_month(month, year);
731 	}
732 
733 	/**
734 	 * Returns the number of weeks in the year, where weeks
735 	 * are taken to start on Monday. Will be 52 or 53. The
736 	 * date must be valid. (Years always have 52 7-day periods,
737 	 * plus 1 or 2 extra days depending on whether it's a leap
738 	 * year. This function is basically telling you how many
739 	 * Mondays are in the year, i.e. there are 53 Mondays if
740 	 * one of the extra days happens to be a Monday.)
741 	 *
742 	 * Params:
743 	 *     year = a year
744 	 *
745 	 * Returns: number of Mondays in the year
746 	 */
747 	public static ubyte getMondayWeeksInYear(GDateYear year)
748 	{
749 		return g_date_get_monday_weeks_in_year(year);
750 	}
751 
752 	/**
753 	 * Returns the number of weeks in the year, where weeks
754 	 * are taken to start on Sunday. Will be 52 or 53. The
755 	 * date must be valid. (Years always have 52 7-day periods,
756 	 * plus 1 or 2 extra days depending on whether it's a leap
757 	 * year. This function is basically telling you how many
758 	 * Sundays are in the year, i.e. there are 53 Sundays if
759 	 * one of the extra days happens to be a Sunday.)
760 	 *
761 	 * Params:
762 	 *     year = year to count weeks in
763 	 *
764 	 * Returns: the number of weeks in @year
765 	 */
766 	public static ubyte getSundayWeeksInYear(GDateYear year)
767 	{
768 		return g_date_get_sunday_weeks_in_year(year);
769 	}
770 
771 	/**
772 	 * Returns %TRUE if the year is a leap year.
773 	 *
774 	 * For the purposes of this function, leap year is every year
775 	 * divisible by 4 unless that year is divisible by 100. If it
776 	 * is divisible by 100 it would be a leap year only if that year
777 	 * is also divisible by 400.
778 	 *
779 	 * Params:
780 	 *     year = year to check
781 	 *
782 	 * Returns: %TRUE if the year is a leap year
783 	 */
784 	public static bool isLeapYear(GDateYear year)
785 	{
786 		return g_date_is_leap_year(year) != 0;
787 	}
788 
789 	/**
790 	 * Generates a printed representation of the date, in a
791 	 * [locale][setlocale]-specific way.
792 	 * Works just like the platform's C library strftime() function,
793 	 * but only accepts date-related formats; time-related formats
794 	 * give undefined results. Date must be valid. Unlike strftime()
795 	 * (which uses the locale encoding), works on a UTF-8 format
796 	 * string and stores a UTF-8 result.
797 	 *
798 	 * This function does not provide any conversion specifiers in
799 	 * addition to those implemented by the platform's C library.
800 	 * For example, don't expect that using g_date_strftime() would
801 	 * make the \%F provided by the C99 strftime() work on Windows
802 	 * where the C library only complies to C89.
803 	 *
804 	 * Params:
805 	 *     s = destination buffer
806 	 *     slen = buffer size
807 	 *     format = format string
808 	 *     date = valid #GDate
809 	 *
810 	 * Returns: number of characters written to the buffer, or 0 the buffer was too small
811 	 */
812 	public static size_t strftime(string s, size_t slen, string format, Date date)
813 	{
814 		return g_date_strftime(Str.toStringz(s), slen, Str.toStringz(format), (date is null) ? null : date.getDateStruct());
815 	}
816 
817 	/**
818 	 * Returns %TRUE if the day of the month is valid (a day is valid if it's
819 	 * between 1 and 31 inclusive).
820 	 *
821 	 * Params:
822 	 *     day = day to check
823 	 *
824 	 * Returns: %TRUE if the day is valid
825 	 */
826 	public static bool validDay(GDateDay day)
827 	{
828 		return g_date_valid_day(day) != 0;
829 	}
830 
831 	/**
832 	 * Returns %TRUE if the day-month-year triplet forms a valid, existing day
833 	 * in the range of days #GDate understands (Year 1 or later, no more than
834 	 * a few thousand years in the future).
835 	 *
836 	 * Params:
837 	 *     day = day
838 	 *     month = month
839 	 *     year = year
840 	 *
841 	 * Returns: %TRUE if the date is a valid one
842 	 */
843 	public static bool validDmy(GDateDay day, GDateMonth month, GDateYear year)
844 	{
845 		return g_date_valid_dmy(day, month, year) != 0;
846 	}
847 
848 	/**
849 	 * Returns %TRUE if the Julian day is valid. Anything greater than zero
850 	 * is basically a valid Julian, though there is a 32-bit limit.
851 	 *
852 	 * Params:
853 	 *     julianDate = Julian day to check
854 	 *
855 	 * Returns: %TRUE if the Julian day is valid
856 	 */
857 	public static bool validJulian(uint julianDate)
858 	{
859 		return g_date_valid_julian(julianDate) != 0;
860 	}
861 
862 	/**
863 	 * Returns %TRUE if the month value is valid. The 12 #GDateMonth
864 	 * enumeration values are the only valid months.
865 	 *
866 	 * Params:
867 	 *     month = month
868 	 *
869 	 * Returns: %TRUE if the month is valid
870 	 */
871 	public static bool validMonth(GDateMonth month)
872 	{
873 		return g_date_valid_month(month) != 0;
874 	}
875 
876 	/**
877 	 * Returns %TRUE if the weekday is valid. The seven #GDateWeekday enumeration
878 	 * values are the only valid weekdays.
879 	 *
880 	 * Params:
881 	 *     weekday = weekday
882 	 *
883 	 * Returns: %TRUE if the weekday is valid
884 	 */
885 	public static bool validWeekday(GDateWeekday weekday)
886 	{
887 		return g_date_valid_weekday(weekday) != 0;
888 	}
889 
890 	/**
891 	 * Returns %TRUE if the year is valid. Any year greater than 0 is valid,
892 	 * though there is a 16-bit limit to what #GDate will understand.
893 	 *
894 	 * Params:
895 	 *     year = year
896 	 *
897 	 * Returns: %TRUE if the year is valid
898 	 */
899 	public static bool validYear(GDateYear year)
900 	{
901 		return g_date_valid_year(year) != 0;
902 	}
903 }