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.
Locked
User avatar
CitrixDude
Posts: 1
Joined: Thu Aug 31, 2006 4:37 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
Joined: Thu Nov 16, 2006 9:02 pm

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
Joined: Thu Nov 16, 2006 9:02 pm

Get previous days Date

Post by donj »

LOL... Seattle, Chicago.. ya, very warm...

User avatar
donj
Posts: 416
Joined: Thu Nov 16, 2006 9:02 pm

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
Joined: Sat Apr 21, 2007 5:59 am

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

Locked