calculate dateformulas

nightrodnightrod Member Posts: 68
Hi,
Is there a way to create a new dateformul bij dividing two other dateformula's?

for example

Dateform1 = 1Y
Dateform2 = 1M

Newdate := dateform1 / dateform2

newdate should give 12M

#-o
Thanx, Jo

Comments

  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    No, it is not possible to divide or multiply date formulas.

    What is possible is to convert both date formulas to text, and add or substract them.

    Dateform1 = 1Y
    Dateform2 = 1M

    Dateform3 = Dateform1 + '+' + Dateform1 : (1Y+1M) - this will work
    Dateform3 = Dateform1 + '-' + Dateform1 : (1Y-1M) - this will also work

    Regards,
    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • kinekine Member Posts: 12,562
    nightrod wrote:
    Hi,
    Is there a way to create a new dateformul bij dividing two other dateformula's?

    for example

    Dateform1 = 1Y
    Dateform2 = 1M

    Newdate := dateform1 / dateform2

    newdate should give 12M

    #-o
    Thanx, Jo

    What result will have this: '+1Y-CY+1M+5D-CM' / '7D' ?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    '+1Y-CY+1M+5D-CM' / '7D' = 28.57142857

    :lol::lol::lol:

    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • kinekine Member Posts: 12,562
    Are you sure? I thought that it would be 4,5714285714285714285714285714286 because it is "1st Feb nextyear" / 7D = 32 / 7 :mrgreen:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    Yes, im sure that '+1Y-CY+1M+5D-CM' / '7D' is equal to 28.57142857. But only TODAY :mrgreen::mrgreen:
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • kinekine Member Posts: 12,562
    Offtopic: just look at the formula - the result is each day the same - 1st February of next year, it means the result is constant... :mrgreen: :whistle:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • BeliasBelias Member Posts: 2,998
    kine wrote:
    Are you sure? I thought that it would be 4,5714285714285714285714285714286 because it is "1st Feb nextyear" / 7D = 32 / 7 :mrgreen:
    First of all: :shock:
    second: can someone explain this to me, please?maybe the CM' / '7D' is done before '+1Y-CY+1M+5D-CM' ?
    Yes, im sure that '+1Y-CY+1M+5D-CM' / '7D' is equal to 28.57142857. But only TODAY
    third: I have a doubt...
    Dateformula := df1 + '+' + df2;
    
    all the variables are dateformula datatype.
    df1 + '+' + df2 <-- this does an implicit correction of the two df to text.
    Dateformula := ... <-- this does an implicit correction from text to df.

    Am I correct?
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • kinekine Member Posts: 12,562
    We are just trying to illustrate the nonsense of the request to be able to do * and / with the dateformulas... :wink:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    First of all: :shock:
    second: can someone explain this to me, please?maybe the CM' / '7D' is done before '+1Y-CY+1M+5D-CM' ?
    Yes, im sure that '+1Y-CY+1M+5D-CM' / '7D' is equal to 28.57142857. But only TODAY
    '+1Y-CY+1M+5D-CM' gives date 10/02/2010. Which is 200 days ahead of TODAY date (bu you know.. only today TODAY :mrgreen::lol::mrgreen:)

    200D / 7D gives 28.57142857 (D gets reduced) :lol::lol::lol::lol:

    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • BeliasBelias Member Posts: 2,998
    kine wrote:
    We are just trying to illustrate the nonsense of the request to be able to do * and / with the dateformulas... :wink:
    For sure, i am :shock: because of the knowledge of you 2...i agree it's pretty useless to * or / dateformulas...
    But studying useless things can uncover more usefule ones.. :mrgreen:
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    all the variables are dateformula datatype.
    df1 + '+' + df2 <-- this does an implicit correction of the two df to text.
    Dateformula := ... <-- this does an implicit correction from text to df.

    Am I correct?
    No you are not :mrgreen:
    What is possible is to convert both date formulas to text, and add or substract them.
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • BeliasBelias Member Posts: 2,998
    Ok, now i'm following you...perfect, i misunderstood a thing of 2...and i've been completely fooled by the '/7D'...which is not possible, of course
    They said it is not possible and then they do it?what the?
    Kine, put more smilies the next time! :wink:
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • kinekine Member Posts: 12,562
    First of all: :shock:
    second: can someone explain this to me, please?maybe the CM' / '7D' is done before '+1Y-CY+1M+5D-CM' ?
    Yes, im sure that '+1Y-CY+1M+5D-CM' / '7D' is equal to 28.57142857. But only TODAY
    '+1Y-CY+1M+5D-CM' gives date 10/02/2010. Which is 200 days ahead of TODAY date (bu you know.. only today TODAY :mrgreen::lol::mrgreen:)

    200D / 7D gives 28.57142857 (D gets reduced) :lol::lol::lol::lol:

    Slawek

    Ah, I understand now. The difference is: today as the base, I took the beginning of the year to calc the number of days to the date to divide... :-$ :mrgreen:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.