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

📄 strftime.html

📁 从www.CppReference.com打包的C++参考手册
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>  <meta name="generator" content=  "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org">  <title>strftime</title>  <link href="../cppreference.css" rel="stylesheet" type="text/css"></head><body><table>  <tr>  <td>  <div class="body-content">  <div class="header-box">    <a href="../index.html">cppreference.com</a> &gt; <a href=    "index.html">Standard C Date &amp; Time</a> &gt; <a href=    "strftime.html">strftime</a>  </div>  <div class="name-format">    strftime  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;time.h&gt;  size_t strftime( char *str, size_t maxsize, const char *fmt, struct tm *time );</pre>  <p>The function strftime() formats date and time information from  <em>time</em> to a format specified by <em>fmt</em>, then stores the  result in <em>str</em> (up to <em>maxsize</em> characters). Certain  codes may be used in <em>fmt</em> to specify different types of  time:</p>  <table class="code-table">    <tr>      <th class="code-table-th">Code</th>      <th class="code-table-th">Meaning</th>    </tr>    <tr>      <td class="code-table-td">%a</td>      <td class="code-table-td">abbreviated weekday name (e.g.      Fri)</td>    </tr>    <tr>      <td class="code-table-td">%A</td>      <td class="code-table-td">full weekday name (e.g. Friday)</td>    </tr>    <tr>      <td class="code-table-td">%b</td>      <td class="code-table-td">abbreviated month name (e.g. Oct)</td>    </tr>    <tr>      <td class="code-table-td">%B</td>      <td class="code-table-td">full month name (e.g. October)</td>    </tr>    <tr>      <td class="code-table-td">%c</td>      <td class="code-table-td">the standard date and time string</td>    </tr>    <tr>      <td class="code-table-td">%d</td>      <td class="code-table-td">day of the month, as a number      (1-31)</td>    </tr>    <tr>      <td class="code-table-td">%H</td>      <td class="code-table-td">hour, 24 hour format (0-23)</td>    </tr>    <tr>      <td class="code-table-td">%I</td>      <td class="code-table-td">hour, 12 hour format (1-12)</td>    </tr>    <tr>      <td class="code-table-td">%j</td>      <td class="code-table-td">day of the year, as a number      (1-366)</td>    </tr>    <tr>      <td class="code-table-td">%m</td>      <td class="code-table-td">month as a number (1-12). Note: some      versions of Microsoft Visual C++ may use values that range from      0-11.</td>    </tr>    <tr>      <td class="code-table-td">%M</td>      <td class="code-table-td">minute as a number (0-59)</td>    </tr>    <tr>      <td class="code-table-td">%p</td>      <td class="code-table-td">locale&#39;s equivalent of AM or      PM</td>    </tr>    <tr>      <td class="code-table-td">%S</td>      <td class="code-table-td">second as a number (0-59)</td>    </tr>    <tr>      <td class="code-table-td">%U</td>      <td class="code-table-td">week of the year, (0-53), where week 1      has the first Sunday</td>    </tr>    <tr>      <td class="code-table-td">%w</td>      <td class="code-table-td">weekday as a decimal (0-6), where      Sunday is 0</td>    </tr>    <tr>      <td class="code-table-td">%W</td>      <td class="code-table-td">week of the year, (0-53), where week 1      has the first Monday</td>    </tr>    <tr>      <td class="code-table-td">%x</td>      <td class="code-table-td">standard date string</td>    </tr>    <tr>      <td class="code-table-td">%X</td>      <td class="code-table-td">standard time string</td>    </tr>    <tr>      <td class="code-table-td">%y</td>      <td class="code-table-td">year in decimal, without the century      (0-99)</td>    </tr>    <tr>      <td class="code-table-td">%Y</td>      <td class="code-table-td">year in decimal, with the century</td>    </tr>    <tr>      <td class="code-table-td">%Z</td>      <td class="code-table-td">time zone name</td>    </tr>    <tr>      <td class="code-table-td">%%</td>      <td class="code-table-td">a percent sign</td>    </tr>  </table>  <p>The strftime() function returns the number of characters put into  <em>str</em>, or zero if an error occurs.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="gmtime.html">gmtime</a><br>    <a href="localtime.html">localtime</a><br>    <a href="time.html">time</a>  </div>  </div>  </td>    </tr>  </table></body></html>

⌨️ 快捷键说明

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