Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Automatic enter the Year in a field

Not applicable
Hi,



I have created a form with some table which contains the past 3 years. So in 2009 I have a field with 2008, a field with 2007 and one with 2006.

In 2008 I had 2007, 2006 and 2005. Now I enter this in a textfield and changes this every year. But now I would like to do this automaticaly.



I can get the current date in a time field but then I have the following format YYYY-MM-DD HH-MM but I only need the YYYY. Once I have this I think I can use calculate to distract the rawvalue with 1, 2 and 3 so I get for 2009: 2009-1=2008 , 2009-2=2007 and 2009-3=2006.
1 Reply
Thomas_McConnac
Level 4
Level 4
var currentTime = new Date();

var year = currentTime.getFullYear();



This gives you a variable "year" which has the current year in YYYY format.



Tom