参考链接:

VC++中CTime类Format参数详解

CTime/COleDateTime::Format方法的使用

http://stat.ethz.ch/R-manual/R-devel/library/base/html/strptime.html

http://www.geezer.org/sw/mvform/doc/strftime.txt

CTime::Format主要用来格式化日期和时间。

举例:

    CTime ctNow=CTime::GetCurrentTime();

    CString strTime1 = ctNow.Format(_T("%Y年%m月%d日"));              // 2014年05月27日
CString strTime2 = ctNow.Format(_T("%Y-%m-%d %H:%M:%S")); // 2014-05-27 14:24:45
CString strTime3 = ctNow.Format(_T("%Y-%#m-%#d %H:%M:%S")); // 2014-5-27 14:24:45
CString strTime4 = ctNow.Format(_T("%c")); // 05/27/14 14:24:45

格式化的参数详细列举如下:

Formats
Description
Memo/Example
%a
abbreviated weekday name 
 
星期的缩写
%A
full weekday name
 
完整的星期名
%b
abbreviated month name
 
月份的缩写
%B
full month name
 
完整的月份名
%c
locale's date and time representation
 
当前区域(设置)的日期和时间, 
如,05/27/14 13:42:43
%d
the day of the month as a decimal number (01-31)
 
如,27
%H
the hour (24-hour clock) as a decimal number(00-23)
 
24小时制的小时(00-23)
%I
the hour (12-hour clock) as a decimal number(01-12)
 
12小时制的小时(00-12)
%j
the day of the year as a decimal number (001-366).
 
一年的第几天
如,147
%m
the month as a decimal number (01-12).
 
月份(00-12)
如,05
%M
the minute as a decimal number (00-59).
 
分钟(00-59)
%p
locale's equivalent of ``AM'' (ante meridiem) or ``PM'' (post meridiem) as appropriate
 
PM 或者 AM
%S
the second as a decimal number (00-60)
 
秒钟(00-59)
%U
the week number of the year (the first Sunday as the first day of week 1) as a decimal number (00-53).
 
一年的第几周(周日是第一周的第一天)
%w
the weekday (Sunday as the first day of the week) as a decimal number (0-6).
 
工作日(0-6,周日是一周的第一天)
%W
 
the week number of the year (the first Monday as the first day of week 1) as a decimal number (00-53).
 
一年的第几周(周一是第一周的第一天)
%x
 
locale's date representation
 
当地区域的日期
如,05/27/2014
%X
 
locale's time representation
 
当地区域的时间
如,13:54:12
%y
 
the year without century as a decimal number (00-99).
 
年(00-99)
如, 14
%Y
 
the year with century as a decimal number.
 
如,2014
%Z
 
the time zone name
 
时区名称
如,China Standard Time

月份的全称和缩写:                                                                            星期的全称和缩写:

Full Month Name

Abbreviated Month Name

January

Jan

February

Feb

March

Mar

April

Apr

May

May

June

Jun

July

Jul

August

Aug

September

Sep

October

Oct

November

Nov

December

Dec

Full Weekday Name

Abbreviated Weekday Name

Sunday

Sun

Monday

Mon

Tuesday

Tue

Wednesday

Wed

Thursday

Thu

Friday

Fri

Saturday

Sat

VC++ CTime Format 详解的更多相关文章

  1. 【转】Java魔法堂:String.format详解

    Java魔法堂:String.format详解     目录     一.前言    二.重载方法     三.占位符     四.对字符.字符串进行格式化     五.对整数进行格式化     六. ...

  2. 【转】declare-styleable的使用(自定义控件) 以及declare-styleable中format详解

    原文网址:http://www.cnblogs.com/622698abc/p/3348692.html declare-styleable是给自定义控件添加自定义属性用的 1.首先,先写attrs. ...

  3. 自定义控件的自定义的属性attrs.xml下的declare-styleable中format详解

    最近在摸索自定义控件,查找到一些自定义属性的一些资料,解决转载记载下来:看了此详解才方便理解! 我们在做项目的时候,由于android自带的属性不能满足需求,android提供了自定义属性的方法,其中 ...

  4. VC++的文件格式详解

    .APS:存放二进制资源的中间文件,VC把当前资源文件转换成二进制格式,并存放在APS文件中,以加快资源装载速度.资源辅助文件. .BMP:位图资源文件. .BSC:浏览信息文件,由浏览信息维护工具( ...

  5. String.format详解(转)

    一.前言 String.format 作为文本处理工具,为我们提供强大而丰富的字符串格式化功能,为了不止步于简单调用 String.format("Hello %s", " ...

  6. Java魔法堂:String.format详解

      目录     一.前言    二.重载方法     三.占位符     四.对字符.字符串进行格式化     五.对整数进行格式化     六.对浮点数进行格式化     七.对日期时间进行格式化 ...

  7. 【转】String.format详解

    一.前言 String.format 作为文本处理工具,为我们提供强大而丰富的字符串格式化功能,为了不止步于简单调用 String.format("Hello %s", " ...

  8. VC++制作DLL详解

    1.    DLL的基本概念 应用程序(exe)要引用目标代码(.obj)外部的函数时,有两种实现途径——静态链接和动态链接. 1.    静态链接 链接程序搜索对应的库文件(.lib),然后将这个对 ...

  9. java String.Format详解

    JDK1.5中,String类新增了一个很有用的静态方法String.format(): format(Locale l, String format, Object... args) 使用指定的语言 ...

随机推荐

  1. JavaScript 要点(十四)HTML DOM 元素(节点)

    A.创建新的 HTML 元素 如需向 HTML DOM 添加新元素,必须首先创建该元素(元素节点),然后向一个已存在的元素追加该元素. <div id="div1"> ...

  2. 实例:ABAP权限对象设计与权限检查的实现(详细)

    学习总结,分享给大家,,,(有图有真像) 我在ECC里创建了一张表,随意插入了5条数据 创建权限对象,使分配这个权限的用户只能操作部门编号(edept)为 ‘10’ 的数据. 1. SU20,创建权限 ...

  3. Select-Object用法

    展开 modules 属性的详细信息 get-process |? {$_.processname -eq "cmd"}|select -ExpandProperty module ...

  4. 2015北京网络赛 H题 Fractal 找规律

    Fractal Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://hihocoder.com/contest/acmicpc2015beijingo ...

  5. 关于【cocos2dx-3.0beta-制作flappybird】教程在3.2project中出现找不到CCMenuItem.h的解决方法

    文章原文:http://blog.csdn.net/kantian_/article/details/36187141 作者升级源码.能够在3.1平台下执行. 我的是vs2013+cocos2dx-3 ...

  6. Chrome 扩展程序 CrxMouse 优化版 v3.0.1

    说明 CrxMouse 原版更新至 v2.7.8,跟进升级优化版至 v3.0.1. 改动说明: 1. 去除可能存在的后台数据上传隐患: 2. 解决鼠标右键拖动时的轨迹漂移问题. 3. 加入部分默认设置 ...

  7. Linux性能及调优指南(翻译)之Linux内存架构

    http://blog.csdn.net/ljianhui/article/details/46734115

  8. js调试技巧 Firefox调试技巧汇总

    Firebug入门指南        :  http://www.ruanyifeng.com/blog/2008/06/firebug_tutorial.html Firebug控制台详解: htt ...

  9. linux 学习笔记 Linux内核的四大功能简介

    一 内存管理 默认情况下,运行在Linux系统上的每个进程都有各自的内存页面:进程不能访问其他进程正在使用的内存页面. 内核维护着自己的内存区域 用户进程不能访问内核进程的内存 可以创建一些共享内存页 ...

  10. centos nginx和tomcat 通过反向代理生成想要的nexus网址

    研究背景: 最近一直在研究maven nexus 私服,所以想在自己带老笔记本上搭建一个私服,看到网上很多私服都有自己带域名,所以想在搭建过程中通过修改host 生成想要带域名 成功截图: 操作步骤: ...