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

Why choose DateTime?

Why use DateTime instead of DateTimeOffset?

1 Reply

SP Sureshkumar P Syncfusion Team October 15, 2019 12:35 PM UTC

Hi Patrick, 

Greetings from Syncfusion support. 

We have not processed the value based on timezone (DateTimeOffset) value in our source end, so we have used DateTime instead of DateTimeOffset. But, you can convert Datetimeoffset value to DateTime and assign the value to our Datetimepicker component. 

Kindly refer to the code block. 

@using Syncfusion.EJ2.Blazor.Calendars; 
 
<EjsDateTimePicker Value="@DateTimeValue"></EjsDateTimePicker> 
 
@code { 
    public DateTimeOffset Value { get; set; } = new DateTimeOffset(2008, 6, 19, 7, 0, 0, new TimeSpan(5, 30, 0)); 
 
    public DateTime DateTimeValue 
    { 
        get 
        { 
            return Value.UtcDateTime; 
        } 
        set 
        { 
            DateTimeValue = Value.UtcDateTime; 
        } 
    } 
} 

We have created a sample based on your requirement. please find the sample here: https://www.syncfusion.com/downloads/support/forum/148306/ze/DateTimePicker162707203  

Regards, 
Sureshkumar P 


Loader.
Live Chat Icon For mobile
Up arrow icon