I have a date/time column. How can I show year & month only on this column (entered automatically is preferred)

Essentially I am making a full digit out of the year and month and sorting it from largest to smallest to show the latest month's file on top. One month must contain one file only.

If it can be done via any other column format/calculated columns, please let me know

3 Answers 3


You can do this with a workflow and use variables to capture the date and substring the results out into different variables you can then combine to make a custom tracking number. Here is an example of how to do it.

Create custom date variable

Once you have the date broken out like you want, you can create a final variable that will work for your unique ID with a date stamp. I use the list item ID in combination with the date variables to make custom identifiers quite a bit. Make sure to have your workflow run when an item is created and set a column to your custom value.


Yep, create a calculated column and do the following, I pointed my column at the created date column for an example. I didn't know the order you wanted so I did 'year''space''month'.

=TEXT([Created],"yyyy"&" "&"mmmm") (show data as single line of text) The result displays: 2017 September

Also you can play with the result formula to change how the data is calculated. yy = 17 yyyy = 2017 mm = 09 mmmm = September etc.

More formulas can be found in your built in SharePoint help, just click on the question mark in the top right corner of the site and search for "formulas" to see an article with more formulas for sharepoint. Here is the article from the support website. https://support.office.com/en-US/article/Examples-of-common-formulas-in-SharePoint-Lists-D81F5F21-2B4E-45CE-B170-BF7EBF6988B3

  • thank you but the issue with calculated columns is that you can't enforce uniqueness. Is there anyway to make this particular column unique?
    – Dingo
    Sep 15, 2017 at 17:14
  • 1
    Hello, I just re-read your post and realized you want to validate and make unique one month/year per item in your list. The built in enforce unique option for a date picker does this by "day" and not month / year like you want it to. Sorry I don't happen to have any solutions off the top of my head for that one. If I come up with something I'll post back.
    – Chris G
    Sep 15, 2017 at 17:47
"$schema":"https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json","elmType":"div","txtContent":"=if(getMonth(@currentField)==0,'Jan',if(getMonth(@currentField)==1,'Feb',if(getMonth(@currentField)==2,'Mar',if(getMonth(@currentField)==3,'Apr',if(getMonth(@currentField)==4,'May',if(getMonth(@currentField)==5,'Jun',if(getMonth(@currentField)==6,'Jul',if(getMonth(@currentField)==7,'Aug',if(getMonth(@currentField)==8,'Sep',if(getMonth(@currentField)==9,'Oct',if(getMonth(@currentField)==10,'Nov','Dec'))))))))))) + '-'+getYear(@currentField) "

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.