I want to get current year in front end using jellyscript

Rishabh2631997
Tera Contributor

i just want to get the current year in front end .using this ${gs.nowDateTime();} im able to get the date and year .but i just want to get the year. do u have  syntax which can help me get this.

 

 

Rishabh2631997_0-1695790553209.jpeg

Rishabh2631997_1-1695790553211.jpg

Thanks

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Rishabh2631997 

use this

${new GlideDateTime().getYearLocalTime()}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Rishabh2631997 

use this

${new GlideDateTime().getYearLocalTime()}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Prashant Ahire
Kilo Sage

 

 

<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


This should show the date as ${gs.now();}<br/>


This should show the date/time as ${gs.nowDateTime();}


</j:jelly>

 

 

Mark as Helpful