J
Jamie Noble
I am parsing a machine generated report that always produces a date
field in the following format:
MM/dd/yyyy
I need to do a number of date operations in a program. All other date
operations are basically just doing things like DateDifferences from
the original report date, datemin and datemax.
Here's partial code showing original date parsing.
sTempOrigDate = "02/25/2004"
sTempMonth = sTempOrigDate.Substring(0, 2)
sTempDay = sTempOrigDate.Substring(3, 2)
sTempYear = sTempOrigDate.Substring(6, 4)
sReportLDate = sTempDay & "/" & sTempMonth & "/" & sTempYear
dReportLDate = Convert.ToDateTime(sReportLDate)
The converted string to date is only used internally for date
calculations and is never used to display output.
I am using Visual Basic .NET
1) What I would prefer to do is simply tell my application to override
the regional settings and instead always use en_us which is in this
format I believe. How do I do this? I believe this format matches the
original report format which would eliminate the need to do the string
operations in the first place.
The reason I want to do this is to avoid any date conversion issues
caused by different regional settings set in control panel.
Can someone help with this. I've seen references to CultureInfo and
threads but I am not really sure if that's either the right way to go
or the easiest way to do this.
Help is appreciated!
~Jamie N
field in the following format:
MM/dd/yyyy
I need to do a number of date operations in a program. All other date
operations are basically just doing things like DateDifferences from
the original report date, datemin and datemax.
Here's partial code showing original date parsing.
sTempOrigDate = "02/25/2004"
sTempMonth = sTempOrigDate.Substring(0, 2)
sTempDay = sTempOrigDate.Substring(3, 2)
sTempYear = sTempOrigDate.Substring(6, 4)
sReportLDate = sTempDay & "/" & sTempMonth & "/" & sTempYear
dReportLDate = Convert.ToDateTime(sReportLDate)
The converted string to date is only used internally for date
calculations and is never used to display output.
I am using Visual Basic .NET
1) What I would prefer to do is simply tell my application to override
the regional settings and instead always use en_us which is in this
format I believe. How do I do this? I believe this format matches the
original report format which would eliminate the need to do the string
operations in the first place.
The reason I want to do this is to avoid any date conversion issues
caused by different regional settings set in control panel.
Can someone help with this. I've seen references to CultureInfo and
threads but I am not really sure if that's either the right way to go
or the easiest way to do this.
Help is appreciated!
~Jamie N