Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2012
    Posts
    20

    Unanswered: Date calculation

    Hi,

    I want to calculate the following date: Starting from todays date, deducted by one month and the 12th of of that month.

    Example:
    Today is 15.Nov.2012
    Result should be: 12.Oct.2012

    Is there any easier way than this one (I did that, but looks quite complex to me for this simple request, there should be an easier way using not so many functions as this will slow down the speed)

    Code:
    date(trim(Char(YEAR(CURRENT DATE - 1 MONTH)))||'-'|| trim(Char(MONTH(CURRENT DATE - 1 MONTH)))||'-12')
    Thanks

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Try:

    Code:
    current date - 1 month - day(current date) days + 12 days
    Andy

  3. #3
    Join Date
    Sep 2012
    Posts
    20
    Perfect! That was what I am looking for!

  4. #4
    Join Date
    Oct 2009
    Location
    221B Baker St.
    Posts
    486
    It is inappropriate to post the same question on multuiple forums

Posting Permissions

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