Question How to get a .NET app to completely ignore timezones? (because of database issues)

kanaida

Member
Joined
Oct 6, 2009
Messages
15
Programming Experience
3-5
I've got a fairly large data application where I use Foxpro Oledb provider in .net to get data and what not.

The problem is, it's foxpro 2.6 (and it's not upgradeable for various reasons).
This version of foxpro does not have the DateTime Type. Just a Date.
It does not support Null's. It has a "Blank Date" value of 12/30/1899.

That date is my problem. See, I am in EST time. I write a new date to a database, say 1/1/2010. Now someone loads my app in california and guess what? he see's this instead: 12/31/2009 9:00PM. See the problem?

so now I can't find blank dates by doing a DataTable.Select(SomeDate = '12/30/1899') nor can I used a greater than or less than because timezones add OR take away hours. :confused:

I have 2 solutions that I can think of:
A) Convert all dates on load. - Epic fail. and performance hit. Don't want this.

B) Find some way to disable timezone corrections.

C) Somehow set the client timezone to EST (but only for my .net app, not globally.)
This is the one I'm really going for and I think would work somehow.


Note: obviously there is no need for "time" to be attached to a date for my type of database so I don't want to write any code to handle dates individually as this would make things impossible.

Any suggestions? special namespaces I don't know about? I mean the DateTime datatype must be reading the timezone from somewhere, and that somewhere is probably reading it from the registry and or pc's clock somehow

Bonus Question:
How to make the datagridview pretend that '12/30/1899' is a Null value (visibly)?
I've usually ended up just coloring the text white. But there must be a way to make it a blank?
 
What happens when you write UTC dates?

Re the bonus question, I think the options youre looking for are in the setup of the datagridviewcolumn itself - there's a way to specify what value is to be considered "null"
 
Back
Top