Showing results for dates and times - Scripting Blog [archived]

Jul 21, 2006
Post comments count0
Post likes count0

How Can I Subtract a Specified Number of Days from a UTC Value?

ScriptingGuy1
ScriptingGuy1

Hey, Scripting Guy! Suppose I get a date-time value in UTC format. How can I subtract x number of days from that value?-- MW Hey, MW. First of all, we’d like to thank you for your question; in addition, we’d like to welcome you and everyone else to today’s Open House in honor of the 500th Hey, Scripting Guy! column. We know that a few of you are...

Scripting Guy!scripting techniquesVBScript
Jul 12, 2006
Post comments count0
Post likes count0

How Can I Determine Last Month’s Date?

ScriptingGuy1
ScriptingGuy1

Hey, Scripting Guy! How can I determine last month’s date? I need to be able to take the month and year for the previous month (using the format mmyy) and create a file name like this: test0606.xls.-- DR Hey, DR. We have to admit that, at first, this question posed a bit of a problem for the Scripting Guys. Not because this is an especially toug...

Scripting Guy!scripting techniquesVBScript
Jan 12, 2006
Post comments count0
Post likes count0

How Can I Determine Which Day of the Year a Date Falls On?

ScriptingGuy1
ScriptingGuy1

Hey, Scripting Guy! How can I determine which day of the year a date falls on? For example, March 2, 2006 is the 61st day of the year.-- TW Hey, TW. You know, we almost feel guilty about answering this question. Why? Well, after all, we can answer it by writing just one line of code:Wscript.Echo DatePart("y", "3/2/2006") Note. So if it’s t...

Scripting Guy!scripting techniquesVBScript
Aug 11, 2005
Post comments count0
Post likes count0

How Can I Determine the Beginning and Ending Date of the Previous Month?

ScriptingGuy1
ScriptingGuy1

Hey, Scripting Guy! Given a specific date, how can I determine the beginning and ending date of the previous month? In other words, given 8/11/2005, I need to get back 7/1/2005 and 7/31/2005.-- PH Hey, PH. You know, this was a tough question for us: after all, as Microsoft employees we’re always looking forward; we never look back. Last month? W...

Scripting Guy!scripting techniquesVBScript
Jul 29, 2005
Post comments count0
Post likes count0

How Can I Tell if a Date Falls within a Specified Time Period?

ScriptingGuy1
ScriptingGuy1

Hey, Scripting Guy! How can I tell if a date falls within a specified time period?-- JW Hey, JW. By amazing coincidence on our way to work this morning we heard two different commercials, from two different companies, touting “Christmas in July.” That prompted us to answer your question as soon as we got to the office. After all, if these compan...

Scripting Guy!scripting techniquesVBScript