Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Dates
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Dates

 Post Reply Post Reply
Author
karp13 View Drop Down
Groupie
Groupie
Avatar

Joined: 03 January 2002
Location: United States
Status: Offline
Points: 152
Post Options Post Options   Thanks (0) Thanks(0)   Quote karp13 Quote  Post ReplyReply Direct Link To This Post Topic: Dates
    Posted: 11 April 2003 at 1:28pm

How would you show the current month name in a label control.  I also need to show last month and 2 months ago. 3 different controls.

I know it has to be easy, but I just can't seem to figure it out for .net.

Thanks for the help

Karp13

Back to Top
xdotnet View Drop Down
Newbie
Newbie


Joined: 20 December 2002
Location: Canada
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote xdotnet Quote  Post ReplyReply Direct Link To This Post Posted: 11 April 2003 at 1:52pm

use MonthName with Now.Month:

lblThisMonthName.Text = MonthName(Now.Month)

lblLastMonthName.Text = MonthName(Now.Month - 1)

Back to Top
karp13 View Drop Down
Groupie
Groupie
Avatar

Joined: 03 January 2002
Location: United States
Status: Offline
Points: 152
Post Options Post Options   Thanks (0) Thanks(0)   Quote karp13 Quote  Post ReplyReply Direct Link To This Post Posted: 11 April 2003 at 2:07pm

That's great! Thank You

Where can I find this information?  I would like to learn more about date formatting and such. 

Back to Top
xdotnet View Drop Down
Newbie
Newbie


Joined: 20 December 2002
Location: Canada
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote xdotnet Quote  Post ReplyReply Direct Link To This Post Posted: 11 April 2003 at 3:17pm

the code i give you is old VB, forget it, it's not a good practice with asp.net. this one is for asp.net:

lblThisMonthName.Text = Now.ToString("MMMM")
lblLastMonthName.Text = Now.AddMonths(-1).ToString("MMMM")

here is 2 links to get some infos about date formatting

DateTimeFormatInfo Class:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemglobalizationdatetimeformatinfoclasstopic.asp


DateTimeFormatInfo.MonthNames Property:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemglobalizationdatetimeformatinfoclassmonthnamestopic.asp


Also you can download the "Class Browser" who come for free with web matrix where you can get properties, methods etc... for each class.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.