SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Apr 2006
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ASP.net Get Previous Month

    I'm new to .Net and I am trying to get the first 3 characters of last month with the 2 digit year concatenated eg AUG07

    I can get the month and year for the current month but i somehow need to subtract a month from it:

    Dim MonthYear As String = DateTime.Now.ToString("MMMyy")

    Any ideas? Your help is appreciated!

  2. #2
    SitePoint Wizard
    Join Date
    Feb 2007
    Posts
    1,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    DateTime.Now.AddMonths(-1).ToString("MMMyy")

  3. #3
    SitePoint Member
    Join Date
    Apr 2006
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. Perfect


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •