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

Change default date format

Hi, i want to know if i can change the default datetime format for every grid that i have in my application.

I want to use UTC format, without setting the format property explicitly in every date column.

Thanks.

1 Reply

VN Vignesh Natarajan Syncfusion Team December 4, 2018 12:30 PM UTC

Hi Neider, 
 
Thanks for using Syncfusion support.  
 
Query: “I want to use UTC format, without setting the format property explicitly in every date column.” 
 
From your query, we understand that you need to display the Date object in form of UTC format without defining the Format for all the date column. 
We can achieve your requirement using two methods. Kindly refer the below  
 
  1.  In MVC we have given support for Data-Annotation. So the you can assign format to column using Data-Annotation by specifying the [DisplayFormat] in the model class.  
 
Refer the below UG documentation for your reference 
 
 
                Note: Data-Annotation will work only when Grid is rendered using Razor format. It will not work when grid is rendered using tag helper.  
 
  1. Based on your dataSource, we can achieve your requirement by defining the format for date column in the load event of ejGrid. By making the load event unique for all the Grid you can set format to all date Column without specifying the format for all the columns.
 
Note: But the above solution will work only for local data.  
 
So kindly share the following details, which help us to Validate the reported issue at our end. 
 
  1. Share the grid rendering code.
  2. Share details regarding your dataSource. Whether it is local data or remote data or you using any type of adaptor to bound data to Grid?
 
Requested details will be helpful for us to achieve your requirement as soon as possible. 
  
Regards, 
Vignesh Natarajan 


Loader.
Live Chat Icon For mobile
Up arrow icon