0

I have a date 2021-06-11T23:59:59.999Z in the format YYYY-MM-DD[T]HH:mm:sssZ and I want to substract one hour from it, so it should look like this:

2021-06-11T00:00:00.001Z

How can I achieve this using VBScript?

Help would be most appreciated, thanks in advance!

Ashwin_23
  • 11
  • 3
  • 1
    You already [asked this](https://stackoverflow.com/q/68769758/692942) and you were pointed to a comprehensive duplicate target with examples, it just needs a little effort from you. Why are you re-posting the same question again? – user692942 Aug 16 '21 at 15:12
  • Especially this bit - Quote: "When formatting date / time values, always store the date / time value first. Also, any needed calculations (`DateAdd()` etc.) should be applied before attempting to format or you will get unexpected results." - Feels relevant. – user692942 Aug 16 '21 at 15:16
  • If you want to subtract from a date / time use [`DateAdd()`](https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/scripting-articles/cb7z8yf9(v=vs.84)) with a negative value. Make sure you are only doing these calculations against an actual date/time variable and not a formatted string representation. You haven't provided any code, so it's difficult to advise. – user692942 Aug 16 '21 at 15:23

0 Answers0