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

6replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
    • Fabio
    • noCodeApp
    • Fabio
    • 3 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

    Like
  • 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

    Like
    • Fabio
    • noCodeApp
    • Fabio
    • 3 yrs ago
    • Reported - view

    Hi. Try this:

     

    format(today(), "YY")

     

    Fabio

    Like
  • 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

    Like
    • Sean
    • Sean
    • 3 yrs ago
    • Reported - view

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

    Like
  • It worked!

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

     

    kevin

    Like
Like Follow
  • 3 yrs agoLast active
  • 6Replies
  • 1751Views