[removed] Return formatted date

前端 未结 3 1208
星月不相逢
星月不相逢 2020-12-07 05:35

I am executing a VBS file that returns the modified date of another file:

Set objFS=CreateObject(\"Scripting.FileSystemObject\")
Set objArgs = WScript.Argume         


        
3条回答
  •  醉酒成梦
    2020-12-07 06:04

    You could just take the date modified of the file and pick it apart a bit..

    So if the last modified date was 11/30/2014, this would return 30/11/2014 regardless of regional PC settings (which FormatDateTime() ignores)

    WScript.Echo convertDate(objFS.GetFile(strFile).DateLastModified)
    
    Function convertDate(strDate)
      convertDate = DatePart("d", strDate) & "/" & DatePart("m", strDate) & "/" & DatePart("yyyy", strDate)
    End Function
    

提交回复
热议问题