SharePoint Online: How to Change Date Format to “DD/MM/YYYY”?

Requirement: Change Date format to “DD/MM/YYYY” in SharePoint Online.

How to Set Date Format in SharePoint Online?

By default, SharePoint Online sites display the dates in US format (MM/DD/YYYY). You may want to change the date format based on the country you live in. Let’s see how to set the date format for a SharePoint Online site:

  • Open your SharePoint site in the web browser
  • Click on Settings gear >> Click on Site settings
  • On the Site settings page, Under Site Administration, click on the “Regional settings” link.
  • Click on the Locale drop-down list arrow, and then select the locale to display dates. E.g. English United Kingdom
    sharepoint online change date format

    This changes the date format everywhere on the site. E.g. List, Columns including Created/Modified, recycle bin, etc.

    change date format in sharepoint online

Pretty simple, huh? Well, The pain part is regional settings should be configured for each site (subsite)! Changing regional settings in the top level site doesn’t automatically propagate the change in its subsites.

Change Date Format in SharePoint Online using PowerShell:

Here is how to change date format (locale) in SharePoint Online site using PowerShell

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
 
#Config parameters for SharePoint Online Site URL and Locale
$SiteURL = "https://crescenttech.sharepoint.com"
$LocaleID ="2057" #English - United Kingdom
 
#Get Credentials to connect
$Cred= Get-Credential
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
   
#Set up the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$Ctx.Credentials = $credentials

#Get Regional Settings of the Web
$Web = $Ctx.Web
$Ctx.Load($web)
$Ctx.Load($Web.RegionalSettings)
$ctx.ExecuteQuery()
 
#Update the LocaleID of the site
$Web.RegionalSettings.LocaleId = $LocaleID
$Web.Update()
$Ctx.ExecuteQuery() 

Any new subsite you create will inherit the Regional Settings from its parent site!

Change Locale for All Sites in SharePoint Online Tenant

We can set the locale for all site sites in SharePoint Online – tenant wide using the below PowerShell script. This script simply loops through all sites and changes the default locale. Just set $AdminSiteURL and $LocaleID variables in the script and provide the credentials to connect to SharePoint Online Admin center once.

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
 
#function to change Locale in regional settings of a SharePoint Online site
Function Set-SPOLocale([String]$SiteURL,[String]$LocaleID, [PSCredential]$Cred)
{ 
     Try
     {
        #Set up the context
        $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
        $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
   
        #Get Regional Settings of the Web
        $Web = $Ctx.Web
        $Ctx.Load($web)
        $Ctx.Load($Web.RegionalSettings)
        $ctx.ExecuteQuery()
 
        #Update the LocaleID of the site
        $Web.RegionalSettings.LocaleId = $LocaleID
        $Web.Update()
        $Ctx.ExecuteQuery()
 
        Write-host -f Green "Locale has been updated for "$Web.Url
 
        #Get all subsites of the web
        $Ctx.Load($Web.Webs)
        $Ctx.executeQuery() 
        #Iterate through each subsites and call the function recursively
        Foreach ($Subweb in $Web.Webs)
        {
            #Call the function to set Locale for the web
            Set-SPOLocale -SiteURL $Subweb.URL -LocaleID $LocaleID -Cred $Cred
        }
    }
    Catch [System.Exception]
    {
        Write-Host -f Red "Error:"$_.Exception.Message
    }
} 
 
#Config parameters for SharePoint Online Admin Center and Locale description
$AdminSiteURL = "https://crescenttech-admin.sharepoint.com"
$LocaleID ="2057"
 
#Get credentials to connect to the SharePoint Online Admin Center
$Credentials = Get-Credential
 
#Connect to SharePoint Online Tenant Admin
Connect-SPOService -URL $AdminSiteURL -Credential $Credentials
 
#Get all Site Collections and Iterate through
Get-SPOSite -Limit ALL | ForEach-Object { 
    Set-SPOLocale -SiteURL $_.URL -LocaleID $LocaleID -Cred $Credentials
}

Refer this Microsoft documentation for all available Locale IDs: https://docs.microsoft.com/en-us/openspecs/office_standards/ms-oe376/6c085406-a698-4e12-9d4d-c3b0ee3dbc4a

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

4 thoughts on “SharePoint Online: How to Change Date Format to “DD/MM/YYYY”?

Leave a Reply