我有数据流以这种格式的日期列:
MM/DD/YYYY H:M:S
并试图将其更改为:
YYYY/MM/DD H:M:S
如果可能的话,我想在 .bat 文件中执行此操作。
编辑,这是 Endoro 的答案:
set "mydate=MM/DD/YYYY H:M:S"
for /f "tokens=1-4 delims=/ " %%i in (txt) do (
set "month=%%i"
set "day=%%j"
set "year=%%k"
set "mytime=%%l"
)
set "newtime=%year%/%month%/%day% %mytime%"
echo %newtime%
让我补充一下,如果有帮助,我想在逗号分隔的文本文件上执行此操作。
编辑:文件的前两行:
05/20/2013 11:00:28,1,048392,3.17,98%,4.8,13.3,50.7,29.2,29.9,29.2,2
05/20/2013 12:00:22,1,048392,3.17,98%,4.8,13.3,50.4,31.6,36,31.4,3