Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Get Previous month and year

Get Previous month and year

Scheduled Pinned Locked Moved ASP.NET
tutorial
5 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    codelinks
    wrote on last edited by
    #1

    hi all, i have requirement to find previous date my input will be month and year, for eg: 01/2009, it should return the month and year exactly six months back i.e 07/2008, how to solve this,

    winnie

    R N 2 Replies Last reply
    0
    • C codelinks

      hi all, i have requirement to find previous date my input will be month and year, for eg: 01/2009, it should return the month and year exactly six months back i.e 07/2008, how to solve this,

      winnie

      R Offline
      R Offline
      Reza Raad
      wrote on last edited by
      #2

      Just create datetime types in .net with your current dates and then use AddMonth with -6 parameter! try it,just two line of code

      Human knowledge belongs to the world

      C N 2 Replies Last reply
      0
      • C codelinks

        hi all, i have requirement to find previous date my input will be month and year, for eg: 01/2009, it should return the month and year exactly six months back i.e 07/2008, how to solve this,

        winnie

        N Offline
        N Offline
        Not Active
        wrote on last edited by
        #3

        Learning to RTFM[^] can AddMonths to your career but AddMonths could be negative as well


        only two letters away from being an asset

        1 Reply Last reply
        0
        • R Reza Raad

          Just create datetime types in .net with your current dates and then use AddMonth with -6 parameter! try it,just two line of code

          Human knowledge belongs to the world

          C Offline
          C Offline
          codelinks
          wrote on last edited by
          #4

          thanks got it

          winnie

          1 Reply Last reply
          0
          • R Reza Raad

            Just create datetime types in .net with your current dates and then use AddMonth with -6 parameter! try it,just two line of code

            Human knowledge belongs to the world

            N Offline
            N Offline
            Not Active
            wrote on last edited by
            #5

            Should have made him work for it, its too simple of a question


            only two letters away from being an asset

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups