📄 date.sgml
字号:
<entry>year.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>number of days in <parameter>month</parameter> during the <parameter>year</parameter>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-date-is-first-of-month">g_date_is_first_of_month ()</title><programlisting><link linkend="gboolean">gboolean</link> g_date_is_first_of_month (const <link linkend="GDate">GDate</link> *date);</programlisting><para>Returns <literal>TRUE</literal> if the date is on the first of a month. The date must be valid.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>date</parameter> :</entry><entry>a <link linkend="GDate">GDate</link> to check.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if the date is the first of the month.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-date-is-last-of-month">g_date_is_last_of_month ()</title><programlisting><link linkend="gboolean">gboolean</link> g_date_is_last_of_month (const <link linkend="GDate">GDate</link> *date);</programlisting><para>Returns <literal>TRUE</literal> if the date is the last day of the month. The date must be valid.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>date</parameter> :</entry><entry>a <link linkend="GDate">GDate</link> to check.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if the date is the last day of the month.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-date-is-leap-year">g_date_is_leap_year ()</title><programlisting><link linkend="gboolean">gboolean</link> g_date_is_leap_year (<link linkend="GDateYear">GDateYear</link> year);</programlisting><para>Returns <literal>TRUE</literal> if the year is a leap year.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>year</parameter> :</entry><entry>year to check.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if the year is a leap year.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-date-get-monday-week-of-year">g_date_get_monday_week_of_year ()</title><programlisting><link linkend="guint">guint</link> g_date_get_monday_week_of_year (const <link linkend="GDate">GDate</link> *date);</programlisting><para>Returns the week of the year, where weeks are understood to start onMonday. If the date is before the first Monday of the year, return0. The date must be valid.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>date</parameter> :</entry><entry>a <link linkend="GDate">GDate</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>week of the year.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-date-get-monday-weeks-in-year">g_date_get_monday_weeks_in_year ()</title><programlisting><link linkend="guint8">guint8</link> g_date_get_monday_weeks_in_year (<link linkend="GDateYear">GDateYear</link> year);</programlisting><para>Returns the number of weeks in the year, where weeks are taken to starton Monday. Will be 52 or 53. The date must be valid. (Years always have 527-day periods, plus 1 or 2 extra days depending on whether it's a leapyear. This function is basically telling you how many Mondays are inthe year, i.e. there are 53 Mondays if one of the extra days happensto be a Monday.)</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>year</parameter> :</entry><entry>a year.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>number of Mondays in the year.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-date-get-sunday-week-of-year">g_date_get_sunday_week_of_year ()</title><programlisting><link linkend="guint">guint</link> g_date_get_sunday_week_of_year (const <link linkend="GDate">GDate</link> *date);</programlisting><para>Returns the week of the year during which this date falls, if weeks are understood to being on Sunday. The date must be valid. Can return 0 if the day is before the first Sunday of the year.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>date</parameter> :</entry><entry>a <link linkend="GDate">GDate</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>week number.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-date-get-sunday-weeks-in-year">g_date_get_sunday_weeks_in_year ()</title><programlisting><link linkend="guint8">guint8</link> g_date_get_sunday_weeks_in_year (<link linkend="GDateYear">GDateYear</link> year);</programlisting><para>Returns the number of weeks in the year, where weeks are taken to starton Sunday. Will be 52 or 53. The date must be valid. (Years always have 527-day periods, plus 1 or 2 extra days depending on whether it's a leapyear. This function is basically telling you how many Sundays are inthe year, i.e. there are 53 Sundays if one of the extra days happensto be a Sunday.)</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>year</parameter> :</entry><entry>year to count weeks in.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>number of weeks.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-date-strftime">g_date_strftime ()</title><programlisting><link linkend="gsize">gsize</link> g_date_strftime (<link linkend="gchar">gchar</link> *s, <link linkend="gsize">gsize</link> slen, const <link linkend="gchar">gchar</link> *format, const <link linkend="GDate">GDate</link> *date);</programlisting><para>Generates a printed representation of the date, in a locale-specificway. Works just like the standard C <function><link linkend="strftime">strftime</link>()</function>function, but only accepts date-related formats; time-related formatsgive undefined results. Date must be valid.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>s</parameter> :</entry><entry>destination buffer.</entry></row><row><entry align="right"><parameter>slen</parameter> :</entry><entry>buffer size.</entry></row><row><entry align="right"><parameter>format</parameter> :</entry><entry>format string.</entry></row><row><entry align="right"><parameter>date</parameter> :</entry><entry>valid <link linkend="GDate">GDate</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>number of characters written to the buffer, or 0 the buffer was too small.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-date-to-struct-tm">g_date_to_struct_tm ()</title><programlisting>void g_date_to_struct_tm (const <link linkend="GDate">GDate</link> *date, struct <link linkend="tm">tm</link> *tm);</programlisting><para>Fills in the date-related bits of a <structname>struct tm</structname>using the <parameter>date</parameter> value. Initializes the non-date parts with somethingsane but meaningless.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>date</parameter> :</entry><entry>a <link linkend="GDate">GDate</link> to set the <structname>struct tm</structname> from.</entry></row><row><entry align="right"><parameter>tm</parameter> :</entry><entry><structname>struct tm</structname> to fill.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-date-valid">g_date_valid ()</title><programlisting><link linkend="gboolean">gboolean</link> g_date_valid (const <link linkend="GDate">GDate</link> *date);</programlisting><para>Returns <literal>TRUE</literal> if the <link linkend="GDate">GDate</link> represents an existing day. The date must notcontain garbage; it should have been initialized with <link linkend="g-date-clear">g_date_clear</link>()if it wasn't allocated by one of the <link linkend="g-date-new">g_date_new</link>() variants.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>date</parameter> :</entry><entry>a <link linkend="GDate">GDate</link> to check.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>Whether the date is valid.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-date-valid-day">g_date_valid_day ()</title><programlisting><link linkend="gboolean">gboolean</link> g_date_valid_day (<link linkend="GDateDay">GDateDay</link> day);</programlisting><para>Returns <literal>TRUE</literal> if the day of the month is valid (a day is valid if it'sbetween 1 and 31 inclusive).</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>day</parameter> :</entry><entry>day to check.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if the day is valid.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-date-valid-month">g_date_valid_month ()</title><programlisting><link linkend="gboolean">gboolean</link> g_date_valid_month (<link linkend="GDateMonth">GDateMonth</link> month);</programlisting><para>Returns <literal>TRUE</literal> if the month value is valid. The 12 <link linkend="GDateMonth">GDateMonth</link>enumeration values are the only valid months.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>month</parameter> :</entry><entry>month.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if the month is valid.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-date-valid-year">g_date_valid_year ()</title><programlisting><link linkend="gboolean">gboolean</link> g_date_valid_year (<link linkend="GDateYear">GDateYear</link> year);</programlisting><para>Returns <literal>TRUE</literal> if the year is valid. Any year greater than 0 is valid,though there is a 16-bit limit to what <link linkend="GDate">GDate</link> will understand.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>year</parameter> :</entry><entry>year.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if the year is valid.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-date-valid-dmy">g_date_valid_dmy ()</title><programlisting><link linkend="gboolean">gboolean</link> g_date_valid_dmy (<link linkend="GDateDay">GDateDay</link> day, <link linkend="GDateMonth">GDateMonth</link> month, <link linkend="GDateYear">GDateYear</link> year);</programlisting><para>Returns <literal>TRUE</literal> if the day-month-year triplet forms a valid, existing dayin the range of days <link linkend="GDate">GDate</link> understands (Year 1 or later, no more thana
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -