We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

FileExplorer change date format

Hi,

Is it possible to change the format of dates to 'DD/MM/YYYY' in the file explorer?

Thank you
Polly

1 Reply

BP Balamurugan P Syncfusion Team December 8, 2016 01:25 PM UTC

Hi Polly, 

Thanks for using Syncfusion Products.  

Yes, it is possible to customize the format of dates 'DD/MM/YYYY' in the ileExplorer control. Usually these date details will be received from file handling service, so you can customize these date formats in the response of the file handling functionalities of FileExplorer.  
  
You can pass the file handling operations response to the following “ConvertDateFormat” function, customize it as per your requirement and finally  return the customized AJAX response.  
  
  
        ConvertDateFormat(operation.Read(args.Path, args.ExtensionsAllow)); 
  
  
        public virtual FileExplorerResponse ConvertDateFormat(object response, bool getDetails= false) 
        { 
            FileExplorerResponse ReadResponse = (FileExplorerResponse) response; 
  
            if (getDetails) 
            { 
                var listResponse = ReadResponse.details.ToList(); 
                for (int i = 0; i < listResponse.Count; i++) 
                { 
                    DateTime created = Convert.ToDateTime(listResponse[i].Created); 
                    listResponse[i].Created = created.ToString("dd/MM/yyyy"); 
                    DateTime modified = Convert.ToDateTime(listResponse[i].Modified); 
                    listResponse[i].Modified = modified.ToString("dd/MM/yyyy"); 
                } 
                ReadResponse.details = listResponse; 
            } 
            else 
            { 
                var listResponse = ReadResponse.files.ToList(); 
                for (int i = 0; i < listResponse.Count; i++) 
                { 
                    DateTime dt = Convert.ToDateTime(listResponse[i].dateModified); 
                    listResponse[i].dateModified = dt.ToString("dd/MM/yyyy"); 
                } 
                ReadResponse.files = listResponse; 
            } 
            
            return ReadResponse; 
        } 
  
  

We have prepared a sample based on this and you can find the sample under the following location:  

  
Please let us know if you require any further assistance. 
  
Regards, 
Balamurugan P 


Loader.
Live Chat Icon For mobile
Up arrow icon