xwei21 发表于 2019-11-8 13:31:22

[已解决]求日期时间转换

本帖最后由 xwei21 于 2019-11-8 16:19 编辑

求教,目前有显示的这个Fri Nov 08 12:52:11 CST 2019日期时间请帮我转换成YYYY/MM/DD hh:mm:ss格式,谢谢了

chzj589 发表于 2019-11-8 14:15:14


$aResult = "Fri Nov 08 12:52:11 CST 2019"
Local $StripWS = StringStripWS($aResult, 8)
Local $sString = StringMid($StripWS, 20, 4) & "年" & StringMid($StripWS, 4, 3) & "月" & StringMid($StripWS, 7, 2) & "日" & StringMid($StripWS, 9, 2) & "时" & StringMid($StripWS, 12, 2) & "分" & StringMid($StripWS, 15, 2) & "秒"
MsgBox(0, "", '日期时间 = ' & $sString)

afan 发表于 2019-11-8 15:52:12

月份简写字母要转换为数字

make2855 发表于 2019-11-8 16:06:11

$s = "Fri Nov 08 12:52:11 CST 2019"
$a = StringSplit($s, " ")
$s2 = $a & "/" & StringFormat("%02d", (StringInStr("JanFebMarAprMayJunJulAugSepOctNovDec", $a) - 1) / 3 + 1) & "/" & $a & " " & $a
MsgBox(0, "", $s2)

xwei21 发表于 2019-11-8 16:18:41

make2855 发表于 2019-11-8 16:06


感谢大哥,你太厉害了
页: [1]
查看完整版本: [已解决]求日期时间转换