⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glib-date-and-time-functions.html

📁 glid编写实例
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<p>Moves a date some number of years into the past. If the current daydoesn't exist in the destination year (i.e. it's February 29 and youmove to a non-leap-year) then the day is changed to February 29. The datemust be valid.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>date</code></em>&#160;:</span></td><td>a <a href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a> to decrement.</td></tr><tr><td><span class="term"><em class="parameter"><code>n_years</code></em>&#160;:</span></td><td>number of years to move.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2992918"></a><h3><a name="g-date-days-between"></a>g_date_days_between ()</h3><a class="indexterm" name="id2992929"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a>        g_date_days_between             (const <a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date1,                                             const <a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date2);</pre><p>Computes the number of days between two dates.If <em class="parameter"><code>date2</code></em> is prior to <em class="parameter"><code>date1</code></em>, the returned value is negative.Both dates must be valid.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>date1</code></em>&#160;:</span></td><td>the first date.</td></tr><tr><td><span class="term"><em class="parameter"><code>date2</code></em>&#160;:</span></td><td>the second date.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td>the number of days between <em class="parameter"><code>date1</code></em> and <em class="parameter"><code>date2</code></em>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2993034"></a><h3><a name="g-date-compare"></a>g_date_compare ()</h3><a class="indexterm" name="id2993044"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a>        g_date_compare                  (const <a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *lhs,                                             const <a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *rhs);</pre><p><code class="function"><code class="function">qsort()</code></code>-style comparsion function for dates. Bothdates must be valid.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>lhs</code></em>&#160;:</span></td><td>first date to compare.</td></tr><tr><td><span class="term"><em class="parameter"><code>rhs</code></em>&#160;:</span></td><td>second date to compare.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td>0 for equal, less than zero if <em class="parameter"><code>lhs</code></em> is less than <em class="parameter"><code>rhs</code></em>,greater than zero if <em class="parameter"><code>lhs</code></em> is greater than <em class="parameter"><code>rhs</code></em>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2993163"></a><h3><a name="g-date-clamp"></a>g_date_clamp ()</h3><a class="indexterm" name="id2993174"></a><pre class="programlisting">void        g_date_clamp                    (<a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date,                                             const <a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *min_date,                                             const <a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *max_date);</pre><p>If <em class="parameter"><code>date</code></em> is prior to <em class="parameter"><code>min_date</code></em>, sets <em class="parameter"><code>date</code></em> equal to <em class="parameter"><code>min_date</code></em>.If <em class="parameter"><code>date</code></em> falls after <em class="parameter"><code>max_date</code></em>, sets <em class="parameter"><code>date</code></em> equal to <em class="parameter"><code>max_date</code></em>.Either <em class="parameter"><code>min_date</code></em> and <em class="parameter"><code>max_date</code></em> may be <code class="literal">NULL</code>.  All non-<code class="literal">NULL</code> datesmust be valid.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>date</code></em>&#160;:</span></td><td>a <a href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a> to clamp.</td></tr><tr><td><span class="term"><em class="parameter"><code>min_date</code></em>&#160;:</span></td><td>minimum accepted value for <em class="parameter"><code>date</code></em>.</td></tr><tr><td><span class="term"><em class="parameter"><code>max_date</code></em>&#160;:</span></td><td>maximum accepted value for <em class="parameter"><code>date</code></em>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2993356"></a><h3><a name="g-date-order"></a>g_date_order ()</h3><a class="indexterm" name="id2993366"></a><pre class="programlisting">void        g_date_order                    (<a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date1,                                             <a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date2);</pre><p>Checks if <em class="parameter"><code>date1</code></em> is less than or equal to <em class="parameter"><code>date2</code></em>,and swap the values if this is not the case.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>date1</code></em>&#160;:</span></td><td>the first date.</td></tr><tr><td><span class="term"><em class="parameter"><code>date2</code></em>&#160;:</span></td><td>the second date.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2993447"></a><h3><a name="g-date-get-day"></a>g_date_get_day ()</h3><a class="indexterm" name="id2993458"></a><pre class="programlisting"><a href="glib-Date-and-Time-Functions.html#GDateDay">GDateDay</a>    g_date_get_day                  (const <a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date);</pre><p>Returns the day of the month. The date must be valid.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>date</code></em>&#160;:</span></td><td>a <a href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a> to extract the day of the month from.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td>day of the month.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2993524"></a><h3><a name="g-date-get-month"></a>g_date_get_month ()</h3><a class="indexterm" name="id2993535"></a><pre class="programlisting"><a href="glib-Date-and-Time-Functions.html#GDateMonth">GDateMonth</a>  g_date_get_month                (const <a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date);</pre><p>Returns the month of the year. The date must be valid.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>date</code></em>&#160;:</span></td><td>a <a href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a> to get the month from.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td>month of the year as a <a href="glib-Date-and-Time-Functions.html#GDateMonth"><span class="type">GDateMonth</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2993609"></a><h3><a name="g-date-get-year"></a>g_date_get_year ()</h3><a class="indexterm" name="id2993619"></a><pre class="programlisting"><a href="glib-Date-and-Time-Functions.html#GDateYear">GDateYear</a>   g_date_get_year                 (const <a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date);</pre><p>Returns the year of a <a href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a>. The date must be valid.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>date</code></em>&#160;:</span></td><td>a <a href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a>.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td>year in which the date falls.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2993692"></a><h3><a name="g-date-get-julian"></a>g_date_get_julian ()</h3><a class="indexterm" name="id2993704"></a><pre class="programlisting"><a href="glib-Basic-Types.html#guint32">guint32</a>     g_date_get_julian               (const <a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date);</pre><p>Returns the Julian day or "serial number" of the <a href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a>. TheJulian day is simply the number of days since January 1, Year 1; i.e.,January 1, Year 1 is Julian day 1; January 2, Year 1 is Julian day 2,etc. The date must be valid.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>date</code></em>&#160;:</span></td><td>a <a href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a> to extract the Julian day from.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td>Julian day.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2993780"></a><h3><a name="g-date-get-weekday"></a>g_date_get_weekday ()</h3><a class="indexterm" name="id2993791"></a><pre class="programlisting"><a href="glib-Date-and-Time-Functions.html#GDateWeekday">GDateWeekday</a> g_date_get_weekday  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -