International Datetime issue!

  • Thread starter Thread starter DBC User
  • Start date Start date
D

DBC User

I needed to move the row from one table another one, so I read and
create a SQL to insert it to the destination table. One of the place I
use DateTime.Parse on the date time field. One thing I noticed is for
international clients (especially Germany) the last part where I have
AM/PM is getting stripped. So when I tried to insert it to the new
table, the insert is failing.

The source has AM/PM and there is not substring operation in the
DateTime.Parse. The pharse command is something like the following
DateTime.Parse(dr[8].ToString())

Any thoughts?
Thanks.
 
I needed to move the row from one table another one, so I read and
create a SQL to insert it to the destination table. One of the place I
use DateTime.Parse on the date time field. One thing I noticed is for
international clients (especially Germany) the last part where I have
AM/PM is getting stripped. So when I tried to insert it to the new
table, the insert is failing.

The source has AM/PM and there is not substring operation in the
DateTime.Parse. The pharse command is something like the following
DateTime.Parse(dr[8].ToString())

Any thoughts?

1) Use DateTime.ParseExact instead of DateTime.Parse

2) Use a parameterised SQL statement or a stored procedure
 
Back
Top