Last active
December 9, 2015 17:49
-
-
Save honda0510/4306310 to your computer and use it in GitHub Desktop.
VBScript向けにFormat関数を作ってみた。でも、コマンドプロンプトが表示される。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
MsgBox Format(Date, "yyyyMMdd") | |
Function Format(DateTime, Pattern) | |
Dim command, wshShell, wshShellStatus, Stream | |
command = "PowerShell -Command Get-Date """ & DateTime & """ -Format """ & Pattern & """" | |
Set wshShell = CreateObject("WScript.Shell") | |
Set wshShellStatus = wshShell.Exec(command) | |
Set Stream = wshShellStatus.StdOut | |
wshShellStatus.Terminate | |
Format = Stream.ReadAll | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment