📄 glib-date-and-time-functions.html
字号:
<tr><td><p><span class="term"><a name="G-DATE-THURSDAY:CAPS"></a><code class="literal">G_DATE_THURSDAY</code></span></p></td><td>Thursday</td></tr><tr><td><p><span class="term"><a name="G-DATE-FRIDAY:CAPS"></a><code class="literal">G_DATE_FRIDAY</code></span></p></td><td>Friday</td></tr><tr><td><p><span class="term"><a name="G-DATE-SATURDAY:CAPS"></a><code class="literal">G_DATE_SATURDAY</code></span></p></td><td>Saturday</td></tr><tr><td><p><span class="term"><a name="G-DATE-SUNDAY:CAPS"></a><code class="literal">G_DATE_SUNDAY</code></span></p></td><td>Sunday</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3036800"></a><h3><a name="G-DATE-BAD-DAY:CAPS"></a>G_DATE_BAD_DAY</h3><a class="indexterm" name="id3036813"></a><pre class="programlisting">#define G_DATE_BAD_DAY 0U</pre><p>Represents an invalid <a class="link" href="glib-Date-and-Time-Functions.html#GDateDay"><span class="type">GDateDay</span></a>.</p></div><hr><div class="refsect2" lang="en"><a name="id3036837"></a><h3><a name="G-DATE-BAD-JULIAN:CAPS"></a>G_DATE_BAD_JULIAN</h3><a class="indexterm" name="id3036850"></a><pre class="programlisting">#define G_DATE_BAD_JULIAN 0U</pre><p>Represents an invalid Julian day number.</p></div><hr><div class="refsect2" lang="en"><a name="id3036866"></a><h3><a name="G-DATE-BAD-YEAR:CAPS"></a>G_DATE_BAD_YEAR</h3><a class="indexterm" name="id3036879"></a><pre class="programlisting">#define G_DATE_BAD_YEAR 0U</pre><p>Represents an invalid year.</p></div><hr><div class="refsect2" lang="en"><a name="id3036895"></a><h3><a name="g-date-new"></a>g_date_new ()</h3><a class="indexterm" name="id3036907"></a><pre class="programlisting"><a class="link" href="glib-Date-and-Time-Functions.html#GDate">GDate</a>* g_date_new (void);</pre><p>Allocates a <a class="link" href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a> and initializes it to a sane state. The new date willbe cleared (as if you'd called <a class="link" href="glib-Date-and-Time-Functions.html#g-date-clear"><code class="function">g_date_clear()</code></a>) but invalid (it won'trepresent an existing day). Free the return value with <a class="link" href="glib-Date-and-Time-Functions.html#g-date-free"><code class="function">g_date_free()</code></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a newly-allocated <a class="link" href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3036983"></a><h3><a name="g-date-new-dmy"></a>g_date_new_dmy ()</h3><a class="indexterm" name="id3036996"></a><pre class="programlisting"><a class="link" href="glib-Date-and-Time-Functions.html#GDate">GDate</a>* g_date_new_dmy (<a class="link" href="glib-Date-and-Time-Functions.html#GDateDay">GDateDay</a> day, <a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth">GDateMonth</a> month, <a class="link" href="glib-Date-and-Time-Functions.html#GDateYear">GDateYear</a> year);</pre><p>Like <a class="link" href="glib-Date-and-Time-Functions.html#g-date-new"><code class="function">g_date_new()</code></a>, but also sets the value of the date. Assuming theday-month-year triplet you pass in represents an existing day, thereturned date will be valid.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>day</code></em> :</span></p></td><td>day of the month</td></tr><tr><td><p><span class="term"><em class="parameter"><code>month</code></em> :</span></p></td><td>month of the year</td></tr><tr><td><p><span class="term"><em class="parameter"><code>year</code></em> :</span></p></td><td>year</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a newly-allocated <a class="link" href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a> initialized with <em class="parameter"><code>day</code></em>, <em class="parameter"><code>month</code></em>, and <em class="parameter"><code>year</code></em></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3037134"></a><h3><a name="g-date-new-julian"></a>g_date_new_julian ()</h3><a class="indexterm" name="id3037147"></a><pre class="programlisting"><a class="link" href="glib-Date-and-Time-Functions.html#GDate">GDate</a>* g_date_new_julian (<a class="link" href="glib-Basic-Types.html#guint32">guint32</a> julian_day);</pre><p>Like <a class="link" href="glib-Date-and-Time-Functions.html#g-date-new"><code class="function">g_date_new()</code></a>, but also sets the value of the date. Assuming theJulian day number you pass in is valid (greater than 0, less than anunreasonably large number), the returned date will be valid.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>julian_day</code></em> :</span></p></td><td>days since January 1, Year 1</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a newly-allocated <a class="link" href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a> initialized with <em class="parameter"><code>julian_day</code></em></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3037232"></a><h3><a name="g-date-clear"></a>g_date_clear ()</h3><a class="indexterm" name="id3037244"></a><pre class="programlisting">void g_date_clear (<a class="link" href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date, <a class="link" href="glib-Basic-Types.html#guint">guint</a> n_dates);</pre><p>Initializes one or more <a class="link" href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a> structs to a sane but invalidstate. The cleared dates will not represent an existing date, but willnot contain garbage. Useful to init a date declared on the stack.Validity can be tested with <a class="link" href="glib-Date-and-Time-Functions.html#g-date-valid"><code class="function">g_date_valid()</code></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td><td>pointer to one or more dates to clear</td></tr><tr><td><p><span class="term"><em class="parameter"><code>n_dates</code></em> :</span></p></td><td>number of dates to clear</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3037335"></a><h3><a name="g-date-free"></a>g_date_free ()</h3><a class="indexterm" name="id3037347"></a><pre class="programlisting">void g_date_free (<a class="link" href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date);</pre><p>Frees a <a class="link" href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a> returned from <a class="link" href="glib-Date-and-Time-Functions.html#g-date-new"><code class="function">g_date_new()</code></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td><td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3037420"></a><h3><a name="g-date-set-day"></a>g_date_set_day ()</h3><a class="indexterm" name="id3037433"></a><pre class="programlisting">void g_date_set_day (<a class="link" href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date, <a class="link" href="glib-Date-and-Time-Functions.html#GDateDay">GDateDay</a> day);</pre><p>Sets the day of the month for a <a class="link" href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a>. If the resulting day-month-yeartriplet is invalid, the date will be invalid.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td><td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>day</code></em> :</span></p></td><td>day to set</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3037518"></a><h3><a name="g-date-set-month"></a>g_date_set_month ()</h3><a class="indexterm" name="id3037530"></a><pre class="programlisting">void g_date_set_month (<a class="link" href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date, <a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth">GDateMonth</a> month);</pre><p>Sets the month of the year for a <a class="link" href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a>. If the resultingday-month-year triplet is invalid, the date will be invalid.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -