Hello,
We use the DateTimeOffset class to persist date/time values in our software. On the client (usually in a XamDataGrid) we would like to have the time displayed as a local time without the offset. To do that I used the following XAML-Code:
<igDP:Field Name="CreatedOn" Label="{l:LocText Erowa.EMC:Terms:CreatedOn}" > <igDP:Field.Settings> <igDP:FieldSettings> <igDP:FieldSettings.EditorStyle> <Style TargetType="igEditors:XamDateTimeEditor"> <Setter Property="Format" Value="G" /> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field>
Now I have a problem when the persisted DateTimeOffset values are stored with different time-offsets. It looks like the offset is simply ignored what results in wrong displayed timestamps.
What can I do to get the correct timestamps?
Regards,Martin
Hello Petar,
I created a sample to show you the problem. The main window contains two grids, both displaying the same data. The upper grid displays the native data, the lower grid formats the DateTimeOffset so that it doesn't show the offset value anymore (<Setter Property"Format" Value="G" />).
What I expected was that if I format the DateTimeOffset, the formatter would not only hide the offset but calculate the correct local time.
I.e. 06:27:00 +00:00 => 07:27:00 (local here is +01:00)
I hope this sample helps you to understand my problem now.
Hello Martin,
I have been looking into you description and I cannot seem to understand what exactly are you trying to achieve. Would you please attach a sample project that illustrates what you are doing and if possible a screenshot of the end result you are striving to reach.
Thanks in advance. Looking forward to hearing from you.