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

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

📁 glid编写实例
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<td>a <a href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>day</code></em>&#160;:</span></td><td>day.</td></tr><tr><td><span class="term"><em class="parameter"><code>month</code></em>&#160;:</span></td><td>month.</td></tr><tr><td><span class="term"><em class="parameter"><code>y</code></em>&#160;:</span></td><td>year.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2992055"></a><h3><a name="g-date-set-julian"></a>g_date_set_julian ()</h3><a class="indexterm" name="id2992066"></a><pre class="programlisting">void        g_date_set_julian               (<a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date,                                             <a href="glib-Basic-Types.html#guint32">guint32</a> julian_date);</pre><p>Sets the value of a <a href="glib-Date-and-Time-Functions.html#GDate"><span class="type">GDate</span></a> from a Julian day number.</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"><em class="parameter"><code>julian_date</code></em>&#160;:</span></td><td>Julian day number (days since January 1, Year 1).</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2992151"></a><h3><a name="g-date-set-time"></a>g_date_set_time ()</h3><a class="indexterm" name="id2992161"></a><pre class="programlisting">void        g_date_set_time                 (<a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date,                                             <a href="glib-Date-and-Time-Functions.html#GTime">GTime</a> time_);</pre><p>Sets the value of a date from a <a href="glib-Date-and-Time-Functions.html#GTime"><span class="type">GTime</span></a> (<span class="type">time_t</span>) value. To set the value of a date to the current day, you could write:</p><div class="informalexample"><pre class="programlisting">g_date_set_time (date, time (NULL));</pre></div><p></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"><em class="parameter"><code>time_</code></em>&#160;:</span></td><td><a href="glib-Date-and-Time-Functions.html#GTime"><span class="type">GTime</span></a> value to set.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2992264"></a><h3><a name="g-date-set-parse"></a>g_date_set_parse ()</h3><a class="indexterm" name="id2992275"></a><pre class="programlisting">void        g_date_set_parse                (<a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date,                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *str);</pre><p>Parses a user-inputted string <em class="parameter"><code>str</code></em>, and try to figure out what date itrepresents, taking the current locale into account. If the string issuccessfully parsed, the date will be valid after the call. Otherwise,it will be invalid. You should check using <a href="glib-Date-and-Time-Functions.html#g-date-valid"><code class="function">g_date_valid()</code></a> to seewhether the parsing succeeded.</p><p>This function is not appropriate for file formats and the like; itisn't very precise, and its exact behavior varies with thelocale. It's intended to be a heuristic routine that guesses what theuser means by a given string (and it does work pretty well in thatcapacity).</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 fill in.</td></tr><tr><td><span class="term"><em class="parameter"><code>str</code></em>&#160;:</span></td><td>string to parse.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2992379"></a><h3><a name="g-date-add-days"></a>g_date_add_days ()</h3><a class="indexterm" name="id2992390"></a><pre class="programlisting">void        g_date_add_days                 (<a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date,                                             <a href="glib-Basic-Types.html#guint">guint</a> n_days);</pre><p>Increments a date some number of days. To move forward by weeks, addweeks*7 days. 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 increment.</td></tr><tr><td><span class="term"><em class="parameter"><code>n_days</code></em>&#160;:</span></td><td>number of days to move the date forward.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2992468"></a><h3><a name="g-date-subtract-days"></a>g_date_subtract_days ()</h3><a class="indexterm" name="id2992479"></a><pre class="programlisting">void        g_date_subtract_days            (<a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date,                                             <a href="glib-Basic-Types.html#guint">guint</a> n_days);</pre><p>Moves a date some number of days into the past. To move by weeks, justmove by weeks*7 days. 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 decrement.</td></tr><tr><td><span class="term"><em class="parameter"><code>n_days</code></em>&#160;:</span></td><td>number of days to move.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2992557"></a><h3><a name="g-date-add-months"></a>g_date_add_months ()</h3><a class="indexterm" name="id2992568"></a><pre class="programlisting">void        g_date_add_months               (<a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date,                                             <a href="glib-Basic-Types.html#guint">guint</a> n_months);</pre><p>Increments a date by some number of months. If the day of the month isgreater than 28, this routine may change the day of the month (becausethe destination month may not have the current day in it). 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 increment.</td></tr><tr><td><span class="term"><em class="parameter"><code>n_months</code></em>&#160;:</span></td><td>number of months to move forward.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2992647"></a><h3><a name="g-date-subtract-months"></a>g_date_subtract_months ()</h3><a class="indexterm" name="id2992658"></a><pre class="programlisting">void        g_date_subtract_months          (<a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date,                                             <a href="glib-Basic-Types.html#guint">guint</a> n_months);</pre><p>Moves a date some number of months into the past. If the current day ofthe month doesn't exist in the destination month, the day of the monthmay change. 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 decrement.</td></tr><tr><td><span class="term"><em class="parameter"><code>n_months</code></em>&#160;:</span></td><td>number of months to move.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2992738"></a><h3><a name="g-date-add-years"></a>g_date_add_years ()</h3><a class="indexterm" name="id2992748"></a><pre class="programlisting">void        g_date_add_years                (<a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date,                                             <a href="glib-Basic-Types.html#guint">guint</a> n_years);</pre><p>Increments a date by some number of years. If the date is February 29,and the destination year is not a leap year, the date will be changedto February 28. 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 increment.</td></tr><tr><td><span class="term"><em class="parameter"><code>n_years</code></em>&#160;:</span></td><td>number of years to move forward.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2992827"></a><h3><a name="g-date-subtract-years"></a>g_date_subtract_years ()</h3><a class="indexterm" name="id2992838"></a><pre class="programlisting">void        g_date_subtract_years           (<a href="glib-Date-and-Time-Functions.html#GDate">GDate</a> *date,                                             <a href="glib-Basic-Types.html#guint">guint</a> n_years);</pre>

⌨️ 快捷键说明

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