 |
| VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1). |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

November 12th, 2003, 11:43 AM
|
|
Authorized User
|
|
Join Date: Oct 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Simple Date question
<edit>Edited to remove the offensive line which was originally meant to be a little bit humourous. I realize that it may be lost in posting. I did do a search using " vb.net" "month name" and variations on that with no luck. I did not mean to imply that anyone else's time was worth being wasted. I just hit a brick wall mentally and was hoping that someone on this board had the solution.</end edit>
I want to get the string name for the current month or of any date variable actually.
Code:
Now().Month.ToString
Just returns the integer value. I could write a simple case subroutine to look at the integer and return the name but I'm hoping that there is a method or property already out there.
Thanks,
Risu
|
|

November 12th, 2003, 11:50 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Right, so because you're too lazy to find out stuff yourself, you expect us to waste our time instead and do your work. Yeah, that makes sense, and I am sure it will get you really far.... ;)
Cheers,
Imar
P.S. Google will give you the answer in 1.5 seconds, less time than it takes the time to post your question here.
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

November 12th, 2003, 12:00 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Oh, I know how to do that . . . . . . . . . . . . . . . . . . . . . . . . .
Sal
|
|

November 12th, 2003, 12:12 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Well, don't bother telling us; We may be too lazy to read this post after all.... ;)
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

November 12th, 2003, 12:15 PM
|
|
Authorized User
|
|
Join Date: Oct 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Fair enough....
ever have one of those moments you just wish you could take back...
Thanks,
Risu
|
|

November 12th, 2003, 12:25 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Being the moderator of the forum I can delete the thread if you wish-- that's as close to taking it back I can do for you :)
Hal Levy
Web Developer, PDI Inc.
NOT a Wiley/Wrox Employee
|
|

November 12th, 2003, 12:27 PM
|
|
Authorized User
|
|
Join Date: Oct 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I hope that this will somewhat makeup for my transgressions.
Code:
Now().ToString("MMM")
I was looking in the wrong place. I kept working off the Month property. I never even realized that some ToString functions have a format parameter. Thank you MSDN
Thanks,
Risu
|
|

November 12th, 2003, 12:43 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
LOL ;)
I believe this is indeed the right way to do it as it will yield CLR compliant code. There is also an alternative in the VisualBasic namespace:
Microsoft.VisualBasic.DateAndTime.MonthName(11)
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|
 |