Strftime () function

Source: Internet
Author: User

Strftime

Syntax:

 
     

  #include <time.h>
  size_t strftime( char *str, size_t maxsize, const char *fmt, struct tm *time );

Function: The function is based on parameters.FMTSet the formatTimeType parameters are formatted as date and time information and stored in stringsStrMedium (upMaxsizeCharacters ). The code used to set different time types is:

Code

Description

%

Scaling form of the week

%

Complete Form of week

% B

Scaling form of month

% B

Complete month format

% C

Scaling form of month

% D

The day of the month (1-31)

% H

Hour, in 24-hour format (0-23)

% I

Hour, 12-hour format (1-12)

% J

The day of the year (1-366)

% M

Month (1-12 ).Note:In some versions of Microsoft Visual C ++, the value range may be 0-11.

% M

Minutes (0-59)

% P

AM or PM of local time)

% S

Seconds (0-59)

% U

The week of the year, and Sunday is the first day of the week.

% W

Number of the day of the week (0-6, Sunday = 0)

% W

The week of the year, and Sunday is the first day of the week.

% X

Standard date string

% X

Standard Time string

% Y

Year (0-99)

% Y

Year in ccyy format (for example, 2004)

% Z

Time zone name

%

Percent sign

The strftime () function returns a processing result string.StrThe number of characters in. If an error occurs, zero is returned.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.