how to find previous date from any dates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sudhaMurugesan
    New Member
    • May 2007
    • 94

    #1

    how to find previous date from any dates

    Hi,
    I need to find the previous date from a given date in java script. Is there any code for it.Can anyone tell me.Thanks in advance
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    What do you mean by previous date? The day before the given date?

    You can just subtract the number of days from the current date, e.g. if you have a date object called date, [code=javascript]date.setDate(da te.getDate() - previous); // where previous is the number of days to subtract[/code]

    Comment

    • jravi96
      New Member
      • Mar 2012
      • 2

      #3
      @acoder, thanks for ur solution, it helped me a lot

      Comment

      Working...