tqsheng

go.....
随笔 - 366, 文章 - 18, 评论 - 101, 引用 - 0
数据加载中……

GetFormattedTime

 

 1 PCHAR
 2 GetFormattedTime(
 3     BOOL bDateToo
 4     )
 5 {
 6     static char szTime[64];
 7     int cch = 0;
 8 
 9     if (bDateToo) {
10 
11         cch =
12             GetDateFormat(
13                 LOCALE_USER_DEFAULT,
14                 0,
15                 NULL,    // current date
16                 "ddd",   // short day of week
17                 szTime,
18                 sizeof szTime
19                 );
20 
21         // cch includes null terminator, change it to
22         // a space to separate from time.
23 
24         szTime[ cch - 1 ] = ' ';
25     }
26 
27     //
28     // Get time and format to characters
29     //
30 
31     GetTimeFormat(
32         LOCALE_USER_DEFAULT,
33         TIME_NOSECONDS,
34         NULL,   // use current time
35         NULL,   // use default format
36         szTime + cch,
37         (sizeof szTime) - cch );
38 
39     return szTime;
40 }
41 

 

posted on 2012-04-04 19:18 tqsheng 阅读(315) 评论(0)  编辑 收藏 引用 所属分类: 资料


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理