title: RegExp to reformat date/time in VBscript
body: <p>I searched endless hours for this but I was unable to find anything that could help me.</p>
  
  <p>I'm writing a script to calculate the launch-time of a particular instance in EC2 and to return the total running time in seconds. When I run this incomplete script I get the value of 'gettimeoutput' as something like '2015-01-28T01:56:11.000Z' (see reference). I just want this in a proper format so that I can use dateDiff() function to calculate time elapsed till the current moment.</p>
  
  <p>'getltimef' would be the starting time in dateDiff readable format and 'timeinsec' would be the final output (time elapsed). Starttimer() function would start a silent timer that will also keep updating the value of 'timeinsec' variable.</p>
  
  <p>Could someone help me with this, please?</p>
  
  <p>References:</p>
  
  <p>1] <a href="https://stackoverflow.com/questions/8155962/php-parsing-amazon-ec2-instance-launchtime">PHP Parsing Amazon EC2 instance &#39;launchTime&#39;</a></p>
  
  <p>2] <a href="http://giantdorks.org/alain/how-to-test-age-of-an-aws-instance-in-a-shell-script-2" rel="nofollow noreferrer">http://giantdorks.org/alain/how-to-test-age-of-an-aws-instance-in-a-shell-script-2</a></p>
  
  <pre><code>Function getinfo()
  
  Set instanceid = CreateObject("MSXML2.XMLHTTP.3.0")
  Set regiondata = CreateObject("MSXML2.XMLHTTP.3.0")
  
  instanceid.Open "GET", "http://169.254.169.254/latest/meta-data/instance-id", False
  instanceid.Send
  regiondata.Open "GET", "http://169.254.169.254/latest/meta-data/placement/availability-zone", False
  regiondata.Send
  
  Const getltimeFinished = 1
  Const getltimeFailed = 2
  getltimeCommand = "aws ec2 --region " regiondata.responseText " describe-instances " instanceid.responseText "--filter=""launch-time"""
  
  Set getltimeShell = CreateObject("WScript.Shell")
  Set getltimeShellExec = getltimeShell.Exec(getltimeCommand)
  
  Select Case getltimeShellExec.Status
  
  Case getltimeFinished
     launchtimedetermined = true
     getltimeOutput = getltimeShellExec.StdOut.ReadAll
  
  Case getltimeFailed
     launchtimedetermined = false
  
  End Select
  
  if (launchtimedetermined) = false Then
  timeinsec = 240
  Else
  
  'getltimef script'
  'getltimef = maybe regexp can work here?'
  'timeinsec = datediff("s", getltimef, now())'
  
  
  Call starttimer()
  
  End Function    
  </code></pre>
  
  <p>Thank you!</p>