How to format date time on post

Hello,

Is there a way to change the format of date time on POST to either ISO or MM/dd/yyyy hh:mm;ss on POST? Default format is "Wed Nov 10 2021 13:42:02 GMT 0800 (Philippine Standard Time)".

Current template is:

    <e-grid-columns>

 <e-grid-column field="PostedOn" headerText="Posted On"

                                   width="150"

                                   format="MM/dd/yyyy hh:mm:ss a"

                                   visible="@visible"

                                   editType="datepickeredit"

                                   allowEditing="@column.Editable"

                                   validationRules="@GetValidationRule(column)"></e-grid-column>

    </e-grid-columns>




1 Reply

PS Pavithra Subramaniyam Syncfusion Team November 24, 2021 03:36 PM UTC

Hi Andrew, 
 
Thanks for contacting Syncfusion support. 
 
You can achieve your requirement by customizing the date value inside the “actionBegin” event before “save” requestType. Please refer to the below code example for more information. 
 
<ejs-grid id="Grid" actionBegin="actionBegin" toolbar="@(new List<string>() { "Add", “Edit”, “Delete”, “Cancel”, “Update”})" > 
    .  .  . 
</ejs-grid> 
 
<script> 
 
Function actionBegin(args) { 
    if (args.requestType == 'save') { 
      var intl = new ej.base.Internationalization(); 
      var dFormatter = intl.getDateFormat({ 
        format: 'MM/dd/yyyy hh:mm:ss a', 
        type'dateTime', 
      }); 
      args.data['OrderDate'] = dFormatter(args.data['OrderDate']); 
    } 
  }, 
</script> 
 
 
If this doesn’t meet your requirement, please share the below details that will be helpful for us to provide an appropriate solution as early as possible.  
 
  1. Share the type of Grid dataSource and Adaptor details
  2. On which action you want to modify the data?
 
Regards, 
Pavithra S 
 


Loader.
Up arrow icon