Json for Microsoft Lists

Vinicius Da Silva Alves 20 Reputation points
2025-11-04T16:09:25.0633333+00:00

I am trying to write a Json in Lists to receive back a date format like mmm/yyyy (e.g. Nov/2025).

Whenever I place the code I get the code in the field itself:
User's image

How to solve that?

Here is the code:
{

"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",

"elmType": "span",

"style": {

"white-space": "nowrap"

},

"txtContent": "=toLocaleDateString([$Date], 'en-US', {month: 'short', year: 'numeric'}).replace(' ', '/')"

}

Microsoft 365 and Office | SharePoint | Development
0 comments No comments
{count} votes

Answer accepted by question author
  1. Teddie-D 7,335 Reputation points Microsoft External Staff Moderator
    2025-11-05T03:27:16.2933333+00:00

    Hi @Vinicius Da Silva Alves

    Thank you for posting your question in the Microsoft Q&A forum.

    If you'd like to format the date in Microsoft Lists as mmm/yyyy, you may try the following JSON:

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
      "elmType": "span",
      "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,'Sept',if(getMonth(@currentField)==9,'Oct',if(getMonth(@currentField)==10,'Nov','Dec'))))))))))) + '/' + getYear(@currentField)"
    }
    

    This is the result:
    User's image I hope this helps. 


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".   

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.  

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.