![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Date Is there a vbs code that returns today's date? I want to return the date in the form, "June 24" (no year). Thanks, Larry |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Date Larry wrote: Quote: > Is there a vbs code that returns today's date? > > I want to return the date in the form, "June 24" (no year). > functions to format as desired. For example: Wscript.Echo MonthName(Month(Now())) & " " & Day(Now()) Displays the current date in the format you requested. -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Date Wscript.Echo MonthName(Month(Now())) & " " & Day(Now()) Richard, That's great, thank you. One other thing: How would I adjust this to get the date prior to the current date? I've tried inserting "-1" in different parts of the code and can't get it. Larry |
My System Specs![]() |
| | #4 (permalink) |
| | Never mind I got it, very simple: Wscript.Echo MonthName(Month(Now())) & " " & Day(Now()-1) |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Never mind "Larry" <larry328NOSPAM@xxxxxx> wrote in message news:%230n5paV9JHA.1340@xxxxxx Quote: >I got it, very simple: > > Wscript.Echo MonthName(Month(Now())) & " " & Day(Now()-1) as 1 July or even worse, on 1 January. Fortunately cscript has a full set of date arithmethic functions such as DateAdd or DateDiff. I recommend you download the helpfile script56.chm from the Microsoft site to see how they're used. |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Never mind Pegasus [MVP] wrote: Quote: > "Larry" <larry328NOSPAM@xxxxxx> wrote in message > news:%230n5paV9JHA.1340@xxxxxx Quote: >> I got it, very simple: >> >> Wscript.Echo MonthName(Month(Now())) & " " & Day(Now()-1) > This does not really work since you will have serious problems on > days such as 1 July or even worse, on 1 January. Fortunately cscript > has a full set of date arithmethic functions such as DateAdd or > DateDiff. Yesterday = Date() - 1 WScript.Echo MonthName(Month(Yesterday)) & " " & Day(Yesterday) Quote: > I recommend you download the helpfile script56.chm from the Microsoft > site to see how they're used. -- Steve Heresy is only another word for freedom of thought. -Graham Greene |
My System Specs![]() |
| | #7 (permalink) |
| | Re: Never mind Thanks. |
My System Specs![]() |
| | #8 (permalink) |
| | Re: Never mind "Steve" <cerberus40@xxxxxx> wrote in message news:OEsZuFX9JHA.1488@xxxxxx Quote: > Pegasus [MVP] wrote: Quote: >> "Larry" <larry328NOSPAM@xxxxxx> wrote in message >> news:%230n5paV9JHA.1340@xxxxxx Quote: >>> I got it, very simple: >>> >>> Wscript.Echo MonthName(Month(Now())) & " " & Day(Now()-1) >> This does not really work since you will have serious problems on >> days such as 1 July or even worse, on 1 January. Fortunately cscript >> has a full set of date arithmethic functions such as DateAdd or >> DateDiff. > Or subtract 1 from the date first and then extract the parts: > > Yesterday = Date() - 1 > WScript.Echo MonthName(Month(Yesterday)) & " " & Day(Yesterday) dangerous problem that the date could change between the two calling instances of the now function. /Al Quote: Quote: >> I recommend you download the helpfile script56.chm from the Microsoft >> site to see how they're used. > I endorse that recommendation! > > -- > Steve > > Heresy is only another word for freedom of thought. -Graham Greene > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Date Taken and Date Modified | Vista music pictures video | |||
| Modified Date used as Date Taken in Photo Gallery and Digital Imag | Vista music pictures video | |||
| Photo date taken vs. file date | Vista music pictures video | |||
| Date | PowerShell | |||
| Blank "Date Taken / Date Modified" field in Vista | Vista file management | |||