asctime

来自cppreference.com
< c | chrono

 
 
日期和时间工具
功能
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
时间操作
Original:
Time manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
difftime
time
clock
格式转换
Original:
Format conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
asctime
ctime
strftime
wcsftime
gmtime
localtime
mktime
常量
Original:
Constants
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
CLOCKS_PER_SEC
类型
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
tm
time_t
clock_t
 
Defined in header <time.h>
char* asctime( const tm* time_ptr );
将定日历转换时间tm的文字表述.
Original:
Converts given calendar time tm to a textual representation.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
得到的字符串具有以下格式:
Original:
The resulting string has the following format:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Www Mmm dd hh:mm:ss yyyy
  • Www - 星期几(之一MonTueWedThuFriSatSun).
    Original:
    Www - the day of the week (one of Mon, Tue, Wed, Thu, Fri, Sat, Sun).
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Mmm - 月(之一JanFebMarAprMayJunJulAugSepOctNovDec).
    Original:
    Mmm - the month (one of Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec).
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • dd - 月的一天
    Original:
    dd - the day of the month
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • hh - 小时
    Original:
    hh - hours
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • mm - 分钟
    Original:
    mm - minutes
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • ss - 秒
    Original:
    ss - seconds
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • yyyy - 年
    Original:
    yyyy - years
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
功能不支持本地化.
Original:
The function does not support localization.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目录

[编辑] 参数

time_ptr -
指定的时间打印到tm对象的指针
Original:
pointer to a tm object specifying the time to print
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[编辑] 返回值

指针指向一个静态的空字符结尾的字符串的文字表示的日期和时间。 asctimectime之间的字符串可以共享,并在每次调用时可能会被覆盖的任何职能.
Original:
pointer to a static null-terminated character string holding the textual representation of date and time. The string may be shared between asctime and ctime, and may be overwritten on each invocation of any of those functions.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[编辑] 注释

这个函数返回一个指向静态数据的指针,是不是线程安全的。 POSIX标志着这个功能已经过时,并建议strftime,而不是.
Original:
This function returns a pointer to static data and is not thread-safe. POSIX marks this function obsolete and recommends strftime instead.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
如果输出的字符串将是超过25个字符的行为是不确定的,如果timeptr->tm_wdaytimeptr->tm_mon没有在预期的范围内,或timeptr->tm_year超过INT_MAX-1990.
Original:
The behavior is undefined if the output string would be longer than 25 characters, if timeptr->tm_wday or timeptr->tm_mon are not within the expected ranges, or if timeptr->tm_year exceeds INT_MAX-1990.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
一些实现处理timeptr->tm_mday==0这意味着前一个月的最后一天.
Original:
Some implementations handle timeptr->tm_mday==0 as meaning the last day of the preceding month.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[编辑] 为例

[编辑] 另请参阅

一个tm对象转换为文本表示
Original:
converts a tm object to a textual representation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数) [edit]
tm对象转换成自定义的文字表述
Original:
converts a tm object to custom textual representation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数) [edit]
C++ documentation for asctime