The format argument consists of one or more codes; as in printf, the formatting codes are preceded by a percent sign (%). Characters that do not begin with % are copied unchanged to strDest. The LC_TIME category of the current locale affects the output formatting of strftime.(For more information on LC_TIME, see setlocale.) The formatting codes for strftime are listed below:

%a

Abbreviated weekday name

%A

Full weekday name

%b

Abbreviated month name

%B

Full month name

%c

Date and time representation appropriate for locale

%d

Day of month as decimal number (01 – 31)

%H

Hour in 24-hour format (00 – 23)

%I

Hour in 12-hour format (01 – 12)

%j

Day of year as decimal number (001 – 366)

%m

Month as decimal number (01 – 12)

%M

Minute as decimal number (00 – 59)

%p

Current locale’s A.M./P.M. indicator for 12-hour clock

%S

Second as decimal number (00 – 59)

%U

Week of year as decimal number, with Sunday as first day of week (00 – 53)

%w

Weekday as decimal number (0 – 6; Sunday is 0)

%W

Week of year as decimal number, with Monday as first day of week (00 – 53)

%x

Date representation for current locale

%X

Time representation for current locale

%y

Year without century, as decimal number (00 – 99)

%Y

Year with century, as decimal number

%z, %Z

Time-zone name or abbreviation; no characters if time zone is unknown

%%

Percent sign

As in the printf function, the # flag may prefix any formatting code. In that case, the meaning of the format code is changed as follows.

Format Code Meaning
%#a, %#A, %#b, %#B, %#p, %#X, %#z, %#Z, %#% # flag is ignored.
%#c Long date and time representation, appropriate for current locale. For example: “Tuesday, March 14, 1995, 12:41:29”.
%#x Long date representation, appropriate to current locale. For example: “Tuesday, March 14, 1995”.
%#d, %#H, %#I, %#j, %#m, %#M, %#S, %#U, %#w, %#W, %#y, %#Y Remove leading zeros (if any).

时间格式化输出strtime的更多相关文章

  1. Python中日期和时间格式化输出的方法

    本文转自:https://www.jb51.net/article/62518.htm 本文实例总结了python中日期和时间格式化输出的方法.分享给大家供大家参考.具体分析如下: python格式化 ...

  2. java代码--Date类获取当前时间-格式化输出

    44:52 阅读数:2299 package cn.Date;   import java.text.Format; import java.text.SimpleDateFormat; import ...

  3. 1、Python 日期时间格式化输出

    今天帮朋友写自动化脚本,又需要用格式化日期,又忘记怎么写了,还是写到自己博客里面,方便日后需要的时候看一眼吧.So,临时加一篇 Python 的文章. 1.Python的time模块 import t ...

  4. 008、MySQL日期时间格式化输出

    #日期格式化 SELECT date_format( '2008/08/08 22:23:01', '%Y-%m-%d-%H--%i--%s' ); 不忘初心,如果您认为这篇文章有价值,认同作者的付出 ...

  5. sql server 查询时间 格式化输出

    use test select * from vote insert into vote (contents) values(GETDATE()) insert into vote (contents ...

  6. Python学习笔记 (2) :字符串输出、操作、格式化和日期、时间格式化

    一.字符串输出及运算 1.常用输出格式及方法 ')#单引号 ")#双引号 """)#三个引号 1234567890 1234567890 1234567890 ...

  7. c++中利用localtime_s函数格式化输出当地日期与时间

    Visual C++ 6.0开发环境中显示当地日期与时间主要通过localtime()函数来实现,该函数的原型在time.h头文件中,其语法格式如下: struct tm *localtime(xon ...

  8. Linux下date命令,格式化输出,时间设置

    date命令的帮助信息 [root@localhost source]# date --help用法:date [选项]... [+格式] 或:date [-u|--utc|--universal] ...

  9. QT-Qt获取当前时间并格式化输出及将积秒转换成时间

    https://blog.csdn.net/u012199908/article/details/50731543 格式化输出当前时刻qDebug()<<"currentTime ...

随机推荐

  1. 关于winform中子窗体最大化的问题

    在构建winform程序时,普遍的做法是将主窗体设置成 MDI Container,使它可以放置工作窗体(Form 而非 UserControl).工作窗体作为子窗体填充工作区,一般设置 FormBo ...

  2. XAOP的使用示范例子

    代码地址如下:http://www.demodashi.com/demo/12976.html XAOP 一个简易的AOP(Android)应用框架.囊括了最实用的AOP应用. 特点 支持快速点击切片 ...

  3. Rest API By JAX-RS 实现接口发布

    原文地址:http://www.cnblogs.com/oopsguy/p/7503589.html JAX-RS 我们在 JAX-RS 示例中使用相同的模型和 DAO,我们所需要做的只有更改 Sto ...

  4. C# JSON序列化日期格式问题

    默认序列化日期为1970至今的时间戳 需要在json.convert中做一些设置 //JavaScriptSerializer js = new JavaScriptSerializer(); Iso ...

  5. VMware12.0下安装CentOS-6.9-x86_64-bin-DVD.iso

    使用的是vmware workstation 12 pro 创建虚拟机 注意上面的 安装程序光盘镜象文件(iso)(M): 是我之前配置,现在可以不做任何处理 此处使用的是centos的64位 在创建 ...

  6. Git使用笔记三

    场景:开源社区提交代码每个人每一个MR只有两个commits,一个是merge前的,一个是merge时候的.因为他们不过是把自己在同一个PR上面提交的commits全部压缩成了一个而已.这个在git上 ...

  7. 在训练CNN时,loss稳定在log(类别数)

    参见知乎问题! https://www.zhihu.com/question/275774218 很多框架都会有一个问题,当卷积 weight NaN 之后,卷积的 output 会变成 NaN.然后 ...

  8. arm linux c++11编译

    include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11 ...

  9. javascript 中对象的拷贝

    http://blog.csdn.net/i10630226/article/details/52431562 在javascript中,对象都是值引用,也就是说,如果你常规的使用 "=&q ...

  10. C# 泛型方法

    泛型方法是使用类型参数声明的方法,如下所示: static void Swap<T>(ref T lhs, ref T rhs) { T temp; temp = lhs; lhs = r ...