Topic
  • 6 replies
  • Latest Post - ‏2013-10-24T15:59:19Z by Archanaa
Archanaa
Archanaa
7 Posts

Pinned topic same week time last year

‏2013-10-21T22:09:26Z |

Hi,

How can I subtract 52 weeks from current date. The pupose is, I want to go back  to the same week day last year and use that date in calculations.

for ex. if today is 2013-10-21, same week day last year date will be 2012-10-22.

Any thoughts?

 

 

 

  • paulhospers
    paulhospers
    4 Posts

    Re: same week time last year

    ‏2013-10-22T15:01:26Z  

    How about

    current date - 1 year

    or

    current date - 12 months

     

  • Archanaa
    Archanaa
    7 Posts

    Re: same week time last year

    ‏2013-10-22T16:19:23Z  

    How about

    current date - 1 year

    or

    current date - 12 months

     

    This will take me back to the same date last year. I want to go back to same week day of last year.

    Let's say today's date '2013-10-22' is a tuesday in 41st week. So, I want to get a date for a Tuesday in 41st week of last year.

     

    Thanks,

  • B.Hauser
    B.Hauser
    283 Posts

    Re: same week time last year

    ‏2013-10-23T07:56:07Z  
    • Archanaa
    • ‏2013-10-22T16:19:23Z

    This will take me back to the same date last year. I want to go back to same week day of last year.

    Let's say today's date '2013-10-22' is a tuesday in 41st week. So, I want to get a date for a Tuesday in 41st week of last year.

     

    Thanks,

    You may try something like this:

    Values(Next_Day(Current_Date - 1 Year, DayName(Current_Date));

    Birgitta

     

     

  • Archanaa
    Archanaa
    7 Posts

    Re: same week time last year

    ‏2013-10-23T16:02:29Z  
    • B.Hauser
    • ‏2013-10-23T07:56:07Z

    You may try something like this:

    Values(Next_Day(Current_Date - 1 Year, DayName(Current_Date));

    Birgitta

     

     

    Yesterday I tried (Current Date -364 days). I tested it and looks like it is working. Can you think of any drawbacks in using it.

    Thank You for the replies.

     

  • B.Hauser
    B.Hauser
    283 Posts

    Re: same week time last year

    ‏2013-10-24T06:54:38Z  
    • Archanaa
    • ‏2013-10-23T16:02:29Z

    Yesterday I tried (Current Date -364 days). I tested it and looks like it is working. Can you think of any drawbacks in using it.

    Thank You for the replies.

     

    What about a leap year? Does it work correctly (I didn't test it out)

    Birgitta

    Updated on 2013-10-24T06:55:37Z at 2013-10-24T06:55:37Z by B.Hauser
  • Archanaa
    Archanaa
    7 Posts

    Re: same week time last year

    ‏2013-10-24T15:59:19Z  
    • B.Hauser
    • ‏2013-10-24T06:54:38Z

    What about a leap year? Does it work correctly (I didn't test it out)

    Birgitta

    It is working!!

    Thanks,