[fpc-pascal] Timezone information in a dataset datetime field? - updated
Michael Van Canneyt
michael at freepascal.org
Sun Jul 24 12:42:25 CEST 2011
On Sat, 23 Jul 2011, Reinier Olislagers wrote:
> Hi all,
> I'm busy with writing an XML export unit targeting Microsoft Access/.Net
> framework (ADO.NET data access framework in particular).
> Runing an ADO.NET demo program I found out that the ADO.NET variant
> requires timezone info in its date/time fields.
> In a sample export I did, it is set to my timezone (UTC+2 at this moment).
> 1. Is there any way of knowing what kind of timezone a datetime value
> should be in a FPC dataset? (I suppose not...)
No, there is no way. It's always supposed to be 'local time'.
> 2. If not, I think I'm going to just use the current timezone. Is there
> any cross-platform way of doing this? In the docs, I just found
> GetLocalTimezone/TZSeconds in e.g. the linux unit... I could of course
> use the Windows API to get something similar on Windows, but what about
> OSX, or BSD or Solaris...
There is currently no crossplatform way to get the timezone.
This is maybe something we should add to the sysutils or dateutils unit.
The solution you posted currently seems the best.
More information about the fpc-pascal