SharePoint Online: How to Change Date Format to “DD/MM/YYYY”?
Requirement: Change the 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 your country. The first step in changing the date format in SharePoint Online is to change the regional settings for the site collection.
Let’s see how to set the date format for SharePoint Online or OneDrive sites:
- Go to the SharePoint Online site collection that you want to change the date format for.
- Click on Settings gear >> Click on Site Information >> View all site settings (URL shortcut: /_layouts/15/settings.aspx).
- On the Site settings page, Under Site Administration, click on the “Regional settings” link.
- Click on the Locale drop-down list arrow and select the locale to display dates. E.g., English, United Kingdom. You can also set other settings like Timezone.
- Click on the OK button at the bottom to save your changes. This changes the date fields everywhere, E.g., List, Columns including Created/Modified, recycle bin, etc., on the whole subsite.
Pretty simple, huh? The pain part is that regional settings should be configured for each site (subsite)! Changing regional settings in the top-level site doesn’t automatically propagate changes in its subsites.
Change Date Format in SharePoint Online using PowerShell
Here is how to change the date format (locale) in the 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://Crescent.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!
Refer to this Microsoft documentation for all available Locale IDs: https://docs.microsoft.com/en-us/openspecs/office_standards/ms-oe376/6c085406-a698-4e12-9d4d-c3b0ee3dbc4a
Change Locale for All Sites in SharePoint Online Tenant
Using the PowerShell script, we can set the locale for all sites in SharePoint Online – tenant-wide. This script 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 the 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://Crescent-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
}
You can also use PnP PowerShell to set the regional settings: How to Change Regional Settings in SharePoint Online using PowerShell?
Conclusion
In conclusion, changing the date format in SharePoint Online can be done in several ways, including changing the regional settings for the site, changing the date format for using PowerShell, and changing the date format for all sites in the tenant. By following these steps, you can ensure that the dates in your SharePoint Online environment are displayed in the format that meets your needs.
There is no confusion when the ISO 8601 format is used:
yyyy-mm-dd
There are plenty of reasons why this is a superior date format, not the least of which is getting the world onto a single gregorian date format. But I suppose we shan’t hold our breaths, as there are still a couple of metric holdouts…
Thanks!! very helpful!
will mention that it isn’t easy to find the site settings so who ever is looking this is it :
http://****YOUR SP SITE ADDRESS****/_layouts/15/settings.aspx
This does not address the confusion when Months are are not spelt out. i.e. There is no confusion when dates are display spelling out the month.
Confusion is the result of all numbers — 3/5/2022 (is March 5th or 3rd May?)
There is no confusion between MAR/5/2022 and 3/MAY/2022
What is the process to have SharePoint display Months using the alphabet?
This doesn’t affect any of the admin centre views or emails (e.g. access approval mails always come as mm/dd/yyyy). The US date format seems to be hard-coded or doesn’t make calls to tenant, user or browser settings. There seems to be little interest from Microsoft in making this a truly global product.
How do you get sharepoint online to convert many types of date format inputs into one default type?
The $ctx.ExecuteQuery() keeps giving me an error (401) Unauthorized, even though the user is a sharepoint primary admin… any ideas?
Hi there, Refer here: SharePoint Online: “The remote server returned an error (401) Unauthorized” Error in PowerShell
Can we do it by folder. When folder get updated will show dd/mm/yyyy. Can we apply it to all sites?
No! Regional settings are scoped at the Web level.
Nice, I was messing up javascript and calculated columns!