Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here's my own attempt. Better solutions will be graciously accepted!</p> <pre><code>Function ToDateTimeStringMinimalSeparators(dateTime) ' -------------------------------------------------------------------------- ' F O R M A T T H E U T C O F F S E T ' -------------------------------------------------------------------------- Dim oShell, activeTimeBias Set oShell = CreateObject("WScript.Shell") activeTimeBias = oShell.RegRead("HKEY_LOCAL_MACHINE\System\" &amp; _ "CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias") Dim sign sign = "-" If activeTimeBias &lt; 0 Then sign = "+" ' Make it positive while we're doing calculations activeTimeBias = activeTimeBias * -1 End If Dim atbHours, atbMins atbHours = Right("00" &amp; Int(activeTimeBias / 60), 2) atbMins = Right("00" &amp; (activeTimeBias Mod 60), 2) If atbMins = "00" Then atbMins = "" End If Dim utcOffset utcOffset = sign &amp; atbHours &amp; atbMins ' -------------------------------------------------------------------------- ' F O R M A T T H E M A I N D A T E ' -------------------------------------------------------------------------- Dim dateBody dateBody = Right("0000" &amp; Year(dateTime), 4) &amp; _ Right("00" &amp; Month(dateTime), 2) &amp; _ Right("00" &amp; Day(dateTime), 2) &amp; _ "T" &amp; _ Right("00" &amp; Hour(dateTime), 2) &amp; _ Right("00" &amp; Minute(dateTime), 2) &amp; _ Right("00" &amp; Second(dateTime), 2) ToDateTimeStringMinimalSeparators = dateBody &amp; utcOffset End Function </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload