Create db entries and query's timezone independent

Jun 20, 2011 at 10:14 AM

Hello Ashley,

I save measurement values with Simol in a local Timezone as local DateTime Values.
All is fine as long I query the values with Simol in the same Timezone.

All breaks down when I query e.g. in Germany.(Where I am incidentally traveled ;) )

I would have to take in account the local time to query the db with the right offset.

For my purpose that is way to complex and I would like to save the values and query

the values timezone independent with the local time. In other words - If I save a value with 2011/05/05 6pm

I would like to wright the Simol query using that time and I would like to get the

measurement value back the same way I saved it without conversion.

Any help on this topic would be great.

Thx a lot, Joe

Coordinator
Jun 20, 2011 at 12:27 PM

Hi Joe,

I recommend that you store UTC date times and convert to local time for display to the user if necessary. If that's not possible you should take a look at the custom formatting options described here. You could either use a CustomFormatAttribute to apply a different date format string to specific object properties or globally replace the date formatter used everywhere in your application.

- Ashley