Workflow to get year value from date column

…this post was published on 2014 August 27.

Let’s suppose we have a list with a column named my_date as a DateTime type, but only date. ​And we need to extract from this field only the year and fill  another column.
First I created a new list , with 3 new fields: my_date, Real_value_for_my_date and  YYYY.

 Now , I added a new item in this list, just for testing

Let’s create the workflow:
First step is to check what about my date column ( my_date ). So I fill Real_value_for_my_data with my_data‘s column value.

After running the workflow you can see that in this value is includeed also the time value

Next steps are to obtain substrings

First step is to get the last ( count it ) 16 chars from end and the second step is to get from this string the first 4 chars

Last step is to fill YYYY column with string2’s value

 After running again the workflow , YYYY column contains year value from my_date column.

Of course, an easiest method is to use a calculated column to get year value.

This entry was posted in Sharepoint, Workflow. Bookmark the permalink.