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
-
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
-
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
-
Hi. Try this:
format(today(), "YY")
Fabio
-
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
-
Change the quotes for YY. See how they are different than the quotes in Fabio’s example.
-
It worked!
didn't see the differences before. Thank you very much!
kevin
Content aside
- 5 yrs agoLast active
- 6Replies
- 1823Views