• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆-145  評論-173  文章-70  trackbacks-0
            先看看代碼再說吧:
            void CTest9Dlg::OnButton1() 
            {
                
            // TODO: Add your control notification handler code here
                myTime = CTime::GetCurrentTime();
                CString myStr 
            = myTime.Format("%Y年%m月%d日 %X");
                SetDlgItemText(IDC_EDIT1,myStr);
            }

            僅僅是上面這個簡單的代碼,就可以實現輸出當前的時間,具體來說就是年月日和時分秒了。

            需要注意的當然是兩個:
            1.得到當前的時間。調用CTime::GetCurrentTime()函數來實現。
            不用驚奇,這里的變量myTime是我手動加在類中的一個成員,而點擊button函數中,只是對它進行了初始化。

            2.輸出格式的問題,以下內容節選自MSDN:

            %D   Total days in this CTime


            %H   Hours in the current day


            %M   Minutes in the current hour


            %S   Seconds in the current minute


            %%   Percent sign 

            上面的是CTime.Formate的改變后的輸出格式,而下面的依舊可以用,沒有改變,繼承了下來。

            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.



            posted on 2010-02-05 12:46 deercoder 閱讀(1102) 評論(0)  編輯 收藏 引用
            久久精品蜜芽亚洲国产AV| 午夜精品久久影院蜜桃| 久久ww精品w免费人成| 久久国产乱子伦精品免费强| 久久精品国产色蜜蜜麻豆| 奇米影视7777久久精品人人爽| 久久精品国产亚洲av日韩| 国内精品伊人久久久久影院对白| 伊人久久无码中文字幕| 品成人欧美大片久久国产欧美| 囯产精品久久久久久久久蜜桃| 国产精品成人99久久久久91gav| 国产欧美久久久精品影院| 国产精品va久久久久久久| 久久精品中文字幕无码绿巨人| 国产亚州精品女人久久久久久 | 久久99久久99小草精品免视看| 合区精品久久久中文字幕一区 | 亚洲色大成网站www久久九| 大美女久久久久久j久久| 99精品国产在热久久无毒不卡| 色播久久人人爽人人爽人人片aV| 久久久久久久综合日本亚洲| 国产成人无码精品久久久性色| 蜜桃麻豆www久久国产精品| 99久久人人爽亚洲精品美女| 99久久婷婷免费国产综合精品| 久久亚洲AV成人无码电影| 久久人人爽人人爽人人片AV东京热| 久久久久国产一级毛片高清板| 99久久无码一区人妻| 777久久精品一区二区三区无码| 国产精品久久国产精麻豆99网站| 久久精品午夜一区二区福利| 成人妇女免费播放久久久| 国产亚洲精久久久久久无码| 国产精品一区二区久久国产| 久久99国产精一区二区三区| 久久91亚洲人成电影网站| 91久久精品无码一区二区毛片| 色综合久久久久|