This code works fine {% TrimStart("2016",2) %} for returning "16"
However this doesn't work {% TrimStart(DateTime.CurrentDateTime.Year,2)%}
Even though there is no mention in the document, I assume .Year is returning a non string type, which causes TrimStart to fail.
How do I convert the return value of DateTime.CurrentDateTime.Year to string? Or how do I return a custom formatted year value from CurrentDateTime.Year such that I get "16" instead of "2016" ?
This seems like a very basic server-side thing to do.. Can't figure out how to do it with K#. Thanks
Check this out: https://docs.kentico.com/display/K9/Reference+-+Macro+methods Search for the ToString method. You may have to play around with the usage, I have done it before, and remember it being difficult to figure out.
argh! i see the toString method there! Don't know how I missed it before, i've been searching all over.. I'll try it out!
Could you please mark an answer appropriately if it was useful for you? Thanks! :)
Please, sign in to be able to submit a new answer.