Results 1 to 6 of 6

Thread: Finding 1 month back from sysdate

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Location
    Tokyo, Japan
    Posts
    72

    Question Finding 1 month back from sysdate

    Hello

    I am searching for a function or solution which gives date of exact 1 month back from sysdate.

    It seems easy but, I afraid that it will create great problem if I do normal coding like just subtracting 1 from month value.

    Please help.

    Best Regards
    Mahesh
    Everybody is always learning something new !

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Location
    Tokyo, Japan
    Posts
    72

    Lightbulb

    Hey

    Just I got hint and I could solve the problem

    It is add_months(sysdate, -1) in Oracle.

    But now I am searching same thing in VB.

    How to find exact one month back in VB ?
    Using Format, DateDiff or anything else ???

    Best Regards
    Mahesh
    Everybody is always learning something new !

  3. #3

  4. #4
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002
    Location
    Eygelshoven
    Posts
    1,611
    Well this should do the trick
    VB Code:
    1. DateNew = Dateadd(-1,"m",DateOld)
    VB6 & C# (WCF LINQ) mostly


    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

    Free online tools

  5. #5
    Addicted Member
    Join Date
    Sep 2003
    Posts
    160
    with all respect but I think you've missed it

    VB Code:
    1. DateNew = DateAdd("m",-1,DateOld)

    S. Mohammad Najafi

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Location
    Tokyo, Japan
    Posts
    72
    Thanks to ALL

    vbcodec is right !!!

    It is DateNew = DateAdd("m",-1,DateOld)

    Mahesh
    Everybody is always learning something new !

Posting Permissions

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



Click Here to Expand Forum to Full Width