Get previous days Date

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 15 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
CitrixDude
Posts: 1
Last visit: Mon Apr 07, 2008 5:36 am

Get previous days Date

Post by CitrixDude »

Does anyone have guidance on how to get the previous days date, naturally this would be in a vbscript? I would need the year, month, and day in UTC format.
Any help or pointers to other resources would be great!
User avatar
donj
Posts: 416
Last visit: Thu May 29, 2008 5:08 am

Get previous days Date

Post by donj »

BTW, DateAdd can add/subtract (by adding a negative number) a day, month, year, hour, or whatever - http://www.w3schools.com/Vbscript/func_dateadd.asp for docs.
User avatar
donj
Posts: 416
Last visit: Thu May 29, 2008 5:08 am

Get previous days Date

Post by donj »

LOL... Seattle, Chicago.. ya, very warm...
User avatar
donj
Posts: 416
Last visit: Thu May 29, 2008 5:08 am

Get previous days Date

Post by donj »

They DO allow it. I just don't get to do it much. I have a conference next month in Orlando, though, so am going a couple days early for a bit of a break.
User avatar
abqbill
Posts: 138
Last visit: Mon Sep 28, 2020 1:20 pm

Get previous days Date

Post by abqbill »

Hi CitrixDude,I know you mentioned VBScript, but this is really easy in JScript:

Code: Select all

var d = new Date(new Date().getTime() - 86400 * 1000);
JScript's dates are all UTC, so it makes things really easy.Bill
This topic is 15 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked