• <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  評(píng)論-173  文章-70  trackbacks-0
            先看看代碼再說(shuō)吧:
            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);
            }

            僅僅是上面這個(gè)簡(jiǎn)單的代碼,就可以實(shí)現(xiàn)輸出當(dāng)前的時(shí)間,具體來(lái)說(shuō)就是年月日和時(shí)分秒了。

            需要注意的當(dāng)然是兩個(gè):
            1.得到當(dāng)前的時(shí)間。調(diào)用CTime::GetCurrentTime()函數(shù)來(lái)實(shí)現(xiàn)。
            不用驚奇,這里的變量myTime是我手動(dòng)加在類中的一個(gè)成員,而點(diǎn)擊button函數(shù)中,只是對(duì)它進(jìn)行了初始化。

            2.輸出格式的問(wèn)題,以下內(nèi)容節(jié)選自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的改變后的輸出格式,而下面的依舊可以用,沒(méi)有改變,繼承了下來(lái)。

            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 閱讀(1096) 評(píng)論(0)  編輯 收藏 引用

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


            久久久久综合网久久| 精品久久久中文字幕人妻| 久久久久亚洲av成人无码电影| 久久久久亚洲AV无码专区桃色| 久久人人爽人人爽人人爽| 青青草原综合久久| 久久精品国产清自在天天线| 国产精品视频久久久| 久久人人爽人人爽人人片av麻烦| 狠狠色丁香婷婷综合久久来| 欧美亚洲国产精品久久| 青青青国产精品国产精品久久久久 | 亚洲精品乱码久久久久久蜜桃 | 91久久精一区二区三区大全| 亚洲国产精品嫩草影院久久| 色综合久久88色综合天天| 亚洲精品无码久久一线| 亚洲中文字幕伊人久久无码| 国产L精品国产亚洲区久久| 浪潮AV色综合久久天堂| 久久无码人妻精品一区二区三区| 久久夜色精品国产噜噜亚洲AV | 色88久久久久高潮综合影院| 亚洲精品tv久久久久久久久久| 丰满少妇人妻久久久久久4| 99国产精品久久久久久久成人热| 国产精品成人久久久| 亚洲伊人久久成综合人影院| 久久午夜综合久久| 久久无码精品一区二区三区| 国产午夜精品理论片久久| 国产成人精品久久亚洲高清不卡| 99久久久精品| 国产精品久久亚洲不卡动漫| 国产精品久久久久影视不卡| 99久久精品午夜一区二区| 97精品伊人久久大香线蕉app| 久久亚洲AV成人无码电影| 国产精品禁18久久久夂久| www久久久天天com| 精品久久久久久久|