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

Time Zone Offset not sent to server

When the DateTimePicker control is used, the selected date and time are sent to the server without time zone information. For example,

Schedule.StartDate=4%2F25%2F2017+2%3A00+PM

How should the control be used to instruct it to send the time zone offset of the browser as part of the form data?

1 Reply

SN Sasikala Nagarajan Syncfusion Team May 5, 2017 04:19 AM UTC

Hi Paul, 
Sorry for the delay, 
How should the control be used to instruct it to send the time zone offset of the browser as part of the form data? 
You can achieve your requirement by changing the date value before post to controller, 
Please refer the below code example, 

@Html.EJ().DateTimePicker("endDate").Value(Model.endDate) 
 
function changeValue(args) { 
        var dateValue = new Date($("#endDate").val()); 
        dateValue.setTime(dateValue.getTime() + dateValue.getTimezoneOffset() * 60 * 1000); 
        $("#endDate").val(dateValue); 
    } 

Here we have changed the value of DateTimePicker control value based on needs manually in submit button click event (in view's script section ). Also in model We have maintained the DateTimePicker value’s member(endDate) in models as string Data Type to achieve this solution. 

Please check with the given solution. If we misunderstood requirement or if still you are facing any issue,  please provide more information  which will help us to provide the exact solution. We will be happy to help you. 
  
Regards 
Sasikala Nagarajan 


Loader.
Up arrow icon