如何让CDateTimeCtrl同时显示日期和时间呢?

如何让CDateTimeCtrl同时显示日期和时间呢?

楼主hundker() 2006-10-30 17:26:38 在 VC/MFC / 基础类 提问

如何让CDateTimeCtrl同时显示日期和时间呢? 问题点数:20、回复次数:13Top

1 楼neosu(CrazyNeo)回复于 2006-10-30 17:29:59 得分 0

我一般用两个并排.  
  否则就要动用activeX控件了Top

2 楼runrunrun(农妇、山泉、有点田)回复于 2006-10-30 17:37:14 得分 0

好象是设置   format   string,用自定义格式Top

3 楼hundker()回复于 2006-10-31 09:31:18 得分 0

format   显示出来后日期不对啊Top

4 楼Saimen(沉默是金)回复于 2006-10-31 09:44:27 得分 0

且两个吧,没必要为这花时间Top

5 楼runrunrun(农妇、山泉、有点田)回复于 2006-10-31 17:21:24 得分 0

CDateTimeCtrl::SetFormat   ("yyyy-MM-dd   HH:mm:ss")Top

6 楼hundker()回复于 2006-11-01 09:37:50 得分 0

这个方法试过了,不行啊Top

7 楼rain4609(昨天还很帅)回复于 2006-11-01 10:50:22 得分 0

"%Y%m%d   %H%M%S"Top

8 楼neosu(CrazyNeo)回复于 2006-11-01 14:02:41 得分 0

CDataTimeCtrl::SetFormat("yyyy-M-d   HH-mm-ss");  
   
   
   
  "d"     The   one-   or   two-digit   day.    
  "dd"     The   two-digit   day.   Single-digit   day   values   are   preceded   by   a   zero.    
  "ddd"     The   three-character   weekday   abbreviation.    
  "dddd"     The   full   weekday   name.    
  "h"     The   one-   or   two-digit   hour   in   12-hour   format.    
  "hh"     The   two-digit   hour   in   12-hour   format.   Single-digit   values   are   preceded   by   a   zero.    
  "H"     The   one-   or   two-digit   hour   in   24-hour   format.    
  "HH"     The   two-digit   hour   in   24-hour   format.   Single-digit   values   are   preceded   by   a   zero.    
  "m"     The   one-   or   two-digit   minute.    
  "mm"     The   two-digit   minute.   Single-digit   values   are   preceded   by   a   zero.    
  "M"     The   one-   or   two-digit   month   number.    
  "MM"     The   two-digit   month   number.   Single-digit   values   are   preceded   by   a   zero.    
  "MMM"     The   three-character   month   abbreviation.    
  "MMMM"     The   full   month   name.    
  "t"     The   one-letter   AM/PM   abbreviation   (that   is,   AM   is   displayed   as   "A").    
  "tt"     The   two-letter   AM/PM   abbreviation   (that   is,   AM   is   displayed   as   "AM").    
  "yy"     The   last   two   digits   of   the   year   (that   is,   1996   would   be   displayed   as   "96").    
  "yyyy"     The   full   year   (that   is,   1996   would   be   displayed   as   "1996").    
  Top

9 楼neosu(CrazyNeo)回复于 2006-11-01 14:03:41 得分 0

如果控件的变量(控制类)为   m_dt  
  则  
  m_dt.SetFormat("yyyy-M-d   HH:mm:ss");Top

10 楼Linda0571()回复于 2006-11-01 14:34:14 得分 0

强烈推荐   neosu(neo)的方法!    
  Top

11 楼hundker()回复于 2006-11-03 10:41:40 得分 0

显示出来月份不正确,居然出现59Top

12 楼neosu(CrazyNeo)回复于 2006-11-03 10:50:08 得分 0

显示出来月份不正确,居然出现59  
  ===  
  给出你的SetFormat代码Top

13 楼runrunrun(农妇、山泉、有点田)回复于 2006-11-03 12:06:27 得分 0

显示出来月份不正确,居然出现59  
   
  ======  
   
  肯定是显示成分钟了。月份是大写的M

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值