主頁(yè) > 知識(shí)庫(kù) > Dos下獲取系統(tǒng)時(shí)間的代碼

Dos下獲取系統(tǒng)時(shí)間的代碼

熱門(mén)標(biāo)簽:如何申請(qǐng)400電話(huà)業(yè)務(wù)mm 電話(huà)機(jī)器人產(chǎn)品怎么樣 清遠(yuǎn)百度地圖標(biāo)注店鋪位置 呼倫貝爾外呼系統(tǒng) 智能打電話(huà)機(jī)器人收費(fèi) 電話(huà)機(jī)器人全國(guó)招商 雷霆電銷(xiāo)機(jī)器人怎么樣 如何弄地圖標(biāo)注 玉林市機(jī)器人外呼系統(tǒng)哪家好

復(fù)制代碼 代碼如下:
 
rem DOS get current time 
rem ======================= 
rem get yyyy/mm/dd 
set mydate=%DATE:~0,10% 
echo %mydate% 
rem ======================= 
rem get yyyy 
set yyyy=%DATE:~0,4% 
echo %yyyy% 
rem ======================= 
rem get mm 
set mm=%DATE:~5,2% 
echo %mm% 
rem ======================= 
rem get dd 
set dd=%DATE:~8,2% 
echo %dd% 
rem ======================= 
rem get yyyy-mm-dd 
set curdate=%yyyy%-%mm%-%dd% 
echo %curdate%


其實(shí)bat中獲取時(shí)間就是利用截取日期字符串的方法

DOS下有字符處理的方法的,總結(jié)如下:

在這個(gè)日期格式下:”2013-07-22 星期一”, 這個(gè)%DATE:~0,10%得到的是2013-07-22
說(shuō)明:DATE為系統(tǒng)變量,“:”表示開(kāi)始處理前面的字符串“~0,10”表示從第0個(gè)字符開(kāi)始取10個(gè)字符。

輸出:

C:\Documents and Settings\Administrator>rem DOS get current time
C:\Documents and Settings\Administrator>rem =======================
C:\Documents and Settings\Administrator>rem get yyyy/mm/dd
C:\Documents and Settings\Administrator>set mydate=2013-07-22
C:\Documents and Settings\Administrator>echo 2013-07-22
2013-07-22
C:\Documents and Settings\Administrator>rem =======================
C:\Documents and Settings\Administrator>rem get yyyy
C:\Documents and Settings\Administrator>set yyyy=2013
C:\Documents and Settings\Administrator>echo 2013
2013
C:\Documents and Settings\Administrator>rem =======================
C:\Documents and Settings\Administrator>rem get mm
C:\Documents and Settings\Administrator>set mm=07
C:\Documents and Settings\Administrator>echo 07
07
C:\Documents and Settings\Administrator>rem =======================
C:\Documents and Settings\Administrator>rem get dd
C:\Documents and Settings\Administrator>set dd=22
C:\Documents and Settings\Administrator>echo 22
22
C:\Documents and Settings\Administrator>rem =======================
C:\Documents and Settings\Administrator>rem get yyyy-mm-dd
C:\Documents and Settings\Administrator>set curdate=2013  -07  -22
C:\Documents and Settings\Administrator>echo 2013  -07  -22
2013  -07  -22
C:\Documents and Settings\Administrator>

您可能感興趣的文章:
  • 系統(tǒng)時(shí)間改為2000年 修改系統(tǒng)時(shí)間病毒
  • javascript 顯示當(dāng)前系統(tǒng)時(shí)間代碼
  • sql server 獲取系統(tǒng)時(shí)間的方法
  • 校準(zhǔn)系統(tǒng)時(shí)間的VBS代碼
  • js顯示當(dāng)前系統(tǒng)時(shí)間的代碼
  • jQuery動(dòng)態(tài)地獲取系統(tǒng)時(shí)間實(shí)現(xiàn)代碼
  • jsp實(shí)現(xiàn)頁(yè)面實(shí)時(shí)顯示當(dāng)前系統(tǒng)時(shí)間的方法
  • TextView顯示系統(tǒng)時(shí)間(時(shí)鐘功能帶秒針變化
  • asp.net中頁(yè)面顯示當(dāng)前系統(tǒng)時(shí)間附圖
  • Android調(diào)用系統(tǒng)時(shí)間格式顯示時(shí)間信息
  • C#實(shí)現(xiàn)修改系統(tǒng)時(shí)間的方法
  • C++設(shè)置系統(tǒng)時(shí)間及系統(tǒng)時(shí)間網(wǎng)絡(luò)更新的方法
  • C++獲取當(dāng)前系統(tǒng)時(shí)間的方法總結(jié)
  • 利用線(xiàn)程實(shí)現(xiàn)動(dòng)態(tài)顯示系統(tǒng)時(shí)間
  • java顯示當(dāng)前的系統(tǒng)時(shí)間

標(biāo)簽:江西 臺(tái)州 樂(lè)山 公主嶺 蕪湖 白銀 株洲 三門(mén)峽

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Dos下獲取系統(tǒng)時(shí)間的代碼》,本文關(guān)鍵詞  Dos,下,獲取,系統(tǒng),時(shí),間的,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Dos下獲取系統(tǒng)時(shí)間的代碼》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于Dos下獲取系統(tǒng)時(shí)間的代碼的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章