H
Henk van Jaarsveld
Can somebody help me on this please,
When queriing on a date on a DataTable a thought I should use the
Date.ToShortDateString() format, for instance like this:
DataRow[] resultRows = dataTable.Select(string.format("STARTDATE <=
#{0}#", dateArgument.ToShortDateString()));
However, I get the impression that a DataTable always expects the
dateformat "M/d/yyyy" no matter what the Locale of the Datatable is.
Because on a system with the dutch language (nl-NL) and the Locale of
the DataTable being dutch, it still expects the "M/d/yyyy" format and
not the "d/M/yyyy" format that is the short datestring format for
dutch. I worked around it by hardcoding the format to "M/d/yyyy" like
this:
DataRow[] resultRows = dataTable.Select(string.format("STARTDATE <=
#{0}#", dateArgument.ToString("M/d/yyyy")));
However this is not very satisfactory, because I have no guarantee
that DataTable really wants this format independent of its Locale.
Can somebody give me the answer to the question WHAT date format does
a data table really expect and is it and how is it dependent on the
Locale or some other localisation setting?
Regards,
Henk van Jaarsveld
When queriing on a date on a DataTable a thought I should use the
Date.ToShortDateString() format, for instance like this:
DataRow[] resultRows = dataTable.Select(string.format("STARTDATE <=
#{0}#", dateArgument.ToShortDateString()));
However, I get the impression that a DataTable always expects the
dateformat "M/d/yyyy" no matter what the Locale of the Datatable is.
Because on a system with the dutch language (nl-NL) and the Locale of
the DataTable being dutch, it still expects the "M/d/yyyy" format and
not the "d/M/yyyy" format that is the short datestring format for
dutch. I worked around it by hardcoding the format to "M/d/yyyy" like
this:
DataRow[] resultRows = dataTable.Select(string.format("STARTDATE <=
#{0}#", dateArgument.ToString("M/d/yyyy")));
However this is not very satisfactory, because I have no guarantee
that DataTable really wants this format independent of its Locale.
Can somebody give me the answer to the question WHAT date format does
a data table really expect and is it and how is it dependent on the
Locale or some other localisation setting?
Regards,
Henk van Jaarsveld