Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Format Long Date

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,49522
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Format Long Date
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Format Long Date - 7/15/2007 7:38:42 PM   
  ryanlcs

 

Posts: 3
Score: 0
Joined: 7/15/2007
Status: offline
HI there...

I need to name a folder with current date,"2007-07-16". I am able to achieve that with the date.
Now I wanted the folder name to have the "Day" such as Monday, Tuesday, Wednesday. I've search around and couldn't get a solution. How can I achieve that?

Thanks.
 
 
Post #: 1
 
 RE: Format Long Date - 7/15/2007 8:07:43 PM   
  Parabellum


Posts: 222
Score: 0
Joined: 11/12/2006
From: UK
Status: offline
vbscript has a function called Weekday that  should help..
it will return a the day as a number 1-7 (the default is sunday = 1)

Example:

dayNo = Weekday(Date)




(in reply to ryanlcs)
 
 
Post #: 2
 
 RE: Format Long Date - 7/16/2007 12:38:55 AM   
  ryanlcs

 

Posts: 3
Score: 0
Joined: 7/15/2007
Status: offline
Well..that's gd. but not really what I want.

(in reply to Parabellum)
 
 
Post #: 3
 
 RE: Format Long Date - 7/16/2007 12:49:53 AM   
  dm_4ever


Posts: 2726
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
quote:

ORIGINAL: ryanlcs

Well..that's gd. but not really what I want.


Actually what Parabellum suggested should get you on your way if you take a minute to see what he is suggesting.

Select Case Weekday(Date)
   Case 1
       WScript.Echo "Sunday"
   Case 2
       WScript.Echo "Monday"
End Select

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ryanlcs)
 
 
Post #: 4
 
 RE: Format Long Date - 7/16/2007 1:58:41 AM   
  ehvbs

 

Posts: 2223
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Just one word:

  WeedayName

(in reply to dm_4ever)
 
 
Post #: 5
 
 RE: Format Long Date - 7/16/2007 3:04:37 AM   
  dm_4ever


Posts: 2726
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
quote:

ORIGINAL: ehvbs

Just one word:

  WeedayName


Even better...thanks!

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ehvbs)
 
 
Post #: 6
 
 RE: Format Long Date - 7/16/2007 11:14:07 AM   
  ryanlcs

 

Posts: 3
Score: 0
Joined: 7/15/2007
Status: offline
quote:

Actually what Parabellum suggested should get you on your way if you take a minute to see what he is suggesting.

Select Case Weekday(Date)
Case 1
   WScript.Echo "Sunday"
Case 2
   WScript.Echo "Monday"
End Select


May be I should adopt this.

I also tried weedayName, but it returns nothing.

But this will solve it.
weekdayname(Weekday(Date))

Thanks!

< Message edited by ryanlcs -- 7/16/2007 11:21:20 AM >

(in reply to dm_4ever)
 
 
Post #: 7
 
 RE: Format Long Date - 7/16/2007 11:20:07 AM   
  dm_4ever


Posts: 2726
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
WScript.Echo WeekdayName(Weekday(Date))

http://msdn2.microsoft.com/en-us/library/00201has.aspx
http://msdn2.microsoft.com/en-us/library/t51x9wtx.aspx

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ryanlcs)
 
 
Post #: 8
 
 RE: Format Long Date - 7/16/2007 10:21:00 PM   
  ehvbs

 

Posts: 2223
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi all,

shame on me! One word = one typo! Sorry about the inconvinience.

ehvbs

(in reply to dm_4ever)
 
 
Post #: 9
 
 RE: Format Long Date - 7/17/2007 12:30:09 AM   
  Parabellum


Posts: 222
Score: 0
Joined: 11/12/2006
From: UK
Status: offline
My appologies, I shall try to be clearer next time, my meaning was infact as dm4-ever ellaberated, however ehvbs's solution is undoubtably better!

(in reply to ryanlcs)
 
 
Post #: 10
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Format Long Date Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts