s=FormatDate(Date, "yyyy-m-dd")
wsh.echo s
Function FormatDate(date_var, patrn)
Dim RegExp, Match, Matches
Set RegExp = New RegExp
With RegExp
.IgnoreCase = -1: .Global = -1
FormatDate = patrn
.pattern = "(yyyy|d|m)"
For Each Match In .execute(patrn)
FormatDate = Replace(FormatDate, Match, DatePart(Match, date_var))
Next
End With
End Function