0

How to get the last two digits of the current year?

My invoice number format is INV-819001 where 19 is the last two digits of the current year.

what code should I use to get it?

thank you very much

kevin

6 replies

null
    • Sviluppatore Ninox
    • Fabio
    • 5 yrs ago
    • Reported - view

    Hello. Suppose that "Invoice N. " is the field (text format) where you enter the invoice number:

     

    substr('Invoice N.', index('Invoice N.', "-") + 2, 2)

     

    Fabio

    • jhkevin1119
    • 5 yrs ago
    • Reported - view

    Hi thank you. But I am actually looking for a method that can get the last two digits of the current year.

    ie 2018 => 18

    2019 => 19

     

    thank you for helping!

    Kevin

    • Sviluppatore Ninox
    • Fabio
    • 5 yrs ago
    • Reported - view

    Hi. Try this:

     

    format(today(), "YY")

     

    Fabio

    • jhkevin1119
    • 5 yrs ago
    • Reported - view

    Hi, I tried, but it keep saying: field not found:YY

    the following is my code

     

    let y := year('Invoice Date');
    let c := cnt(select Invoice where year('Invoice Date') = y);
    'Invoice No' := format(today(), “YY”) + "-" + format(c, "000")

     

    Could you help me to check?

    thank you

    Kevin

    • Sean
    • 5 yrs ago
    • Reported - view

    Change the quotes for YY. See how they are different than the quotes in Fabio’s example.

    • jhkevin1119
    • 5 yrs ago
    • Reported - view

    It worked!

    didn't see the differences before. Thank you very much!

     

    kevin

Content aside

  • 5 yrs agoLast active
  • 6Replies
  • 1822Views