Dr
Wed May 24 09:11:06 CDT 2006
JRS: In article <186DAFD2-57CB-4294-A249-5CD8EFF5DD7F@microsoft.com>,
dated Tue, 23 May 2006 00:48:02 remote, seen in news:microsoft.public.sc
ripting.vbscript, Robert <Robert@discussions.microsoft.com> posted :
>
>'=#=#= Convert to Date dd/mm/yyyy =#=#=
>Function WMIDateStringToDate(dtmDate)
> On error resume Next
> WMIDateStringToDate = CDate(Mid(dtmDate, 7, 2) & "/" & _
> Mid(dtmDate, 5, 2) & "/" & Left(dtmDate, 4) _
> & " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) _
> & ":" & Mid(dtmDate,13, 2))
>End Function
It seems that dtmDate is of the form "YYYYMMDDhmmss". In Javascript,
dtmDate = "YYYYMMDDhhmmss"
dtmDate.replace(/(....)(..)(..)(..)(..)(..)/, "$3/$2/$1 $4:$5:$6")
gives string "DD/MM/YYYY hh:mm:ss".
Can one not do similarly in later VBS? it would seem possibly briefer
and more efficient.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:
http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:
http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:
http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.