• <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 閱讀(1099) 評論(0)  編輯 收藏 引用
            人妻精品久久无码区| 欧美亚洲国产精品久久蜜芽| 99久久香蕉国产线看观香| 狠狠色丁香婷婷综合久久来来去 | 新狼窝色AV性久久久久久| 99蜜桃臀久久久欧美精品网站 | 久久综合丁香激情久久| 久久综合成人网| 国产∨亚洲V天堂无码久久久| 久久国产精品二国产精品| 日韩精品久久久久久免费| 久久久艹| 久久免费美女视频| 亚洲精品乱码久久久久久蜜桃| 国内精品久久久久影院日本 | 伊人久久大香线焦AV综合影院| 国产精品久久久久久久午夜片| 综合久久国产九一剧情麻豆| 国内精品久久久久久麻豆| 色欲av伊人久久大香线蕉影院| 久久免费香蕉视频| 91精品国产高清久久久久久国产嫩草| 少妇久久久久久久久久| 亚洲伊人久久综合中文成人网| 国内精品久久久久久久coent| 国产精品久久久久久影院 | 日本精品久久久久影院日本| 7国产欧美日韩综合天堂中文久久久久| 精产国品久久一二三产区区别 | 伊人精品久久久久7777| 国产精品伦理久久久久久| 精品久久一区二区三区| 无码国产69精品久久久久网站 | 一本伊大人香蕉久久网手机| 99久久精品影院老鸭窝| 久久精品国产第一区二区三区 | 亚洲国产天堂久久综合| 日日狠狠久久偷偷色综合96蜜桃| 久久国产精品国语对白| 无码任你躁久久久久久| 久久婷婷五月综合97色直播|