How to Change Friendly Date Format in SharePoint?

Problem: After migrating to SharePoint 2016, all date columns changed to "Friendly" format! That is instead of exact date, date fields started showing values such as "2 days ago", "About a minute ago", "3 hours ago", "Today at 3:00 PM", etc.

How to Change Friendly Date Format in SharePoint 2016?
To change the date field to show date time in standard format,
  • Go to List settings >> Pick the Field to get the Field settings 
  • You can switch the format from Friendly to Standard mode. sharepoint 2016 change friendly date format

PowerShell to Disable Friendly Display Format in SharePoint Date Columns
Lets disable friendly date format in all date columns of a SharePoint list using PowerShell.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Config variables
$SiteURL="http://intranet.crescent.com"
$ListName="Projects"

#Get the List from the web
$Web = Get-SPWeb $SiteURL
$List = $Web.Lists[$ListName]

#Loop through each list field
ForEach($Field in $List.Fields)
{
    #Pick Date Columns
    If($Field.Type -eq "DateTime")
    {
        #Disable Friendly Display format
        $Field.FriendlyDisplayFormat="Disabled" #Relative
        $Field.update()               
        Write-Host -f Green "`t `t Field Updated:"$Field.Title
    }
}

Change Friendly Date Format to Standard in All Date Columns of a Site Collection:
Lets change the friendly date format to standard date format in all date columns of all lists and libraries in a SharePoint site collection using PowerShell.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Set Site Collection variable
$SiteURL="http://intranet.crescent.com"

#Get All Webs of the Site Collection
$WebColl = Get-SPSite $SiteURL | Get-SPWeb -Limit All
 
#Iterate through each web
Foreach($Web in $WebColl)
{
    Write-host -f Yellow "Processing Web:"$Web.Url

    #Get All Lists of the web
    $ListColl = $Web.Lists

    #Loop through each list 
    Foreach($List in @($ListColl))
    {
        Write-Host -f Yellow "`t Processing List:" $List.Title
        
        $ListFields = $List.Fields
        #Loop through each field
        ForEach($Field in @($ListFields))
        {
            #Get the Field to suppress "Collection was modified" Error
            $Column = $List.Fields.GetFieldByInternalName($Field.InternalName)

            #Pick Date Columns
            If($Column.Type -eq "DateTime")
            {
                Write-Host -f Green "`t `t Field Updated:"$Column.Title

                #Disable Friendly Display format
                $Column.FriendlyDisplayFormat="Disabled" #Relative
                $Column.update()               
            }
         }
     }
}
How to Change Friendly Date Format in SharePoint? How to Change Friendly Date Format in SharePoint? Reviewed by Salaudeen Rajack on January 06, 2017 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.