I was trying to parse a string to OracleTimeStamp. I found if I use the format string "MM/DD/YYYY HH:MI:SS.FF", it always show PM
OracleTimeStamp.Parse("12/23/2011 12:01:38.99 AM", "MM/DD/YYYY HH:MI:SS.FF", OracleDbType.TimeStamp)
12/23/2011 12:01:38 PM
OracleTimeStamp.Parse("12/23/2011 12:01:38.99 PM", "MM/DD/YYYY HH:MI:SS.FF", OracleDbType.TimeStamp)
12/23/2011 12:01:38 PM
If I use "MM/DD/YYYY HH:MI:SS.FF AM", it flips AM to PM and PM to AM.
OracleTimeStamp.Parse("12/23/2011 12:01:38.99 PM", "MM/DD/YYYY HH:MI:SS.FF AM", OracleDbType.TimeStamp)
12/23/2011 12:01:38 AM
OracleTimeStamp.Parse("12/23/2011 12:01:38.99 AM", "MM/DD/YYYY HH:MI:SS.FF AM", OracleDbType.TimeStamp)
12/23/2011 12:01:38 PM
It looks a bug to me. Or anyone can suggest a correct format string to make it work?
Thanks!
OracleTimeStamp.Parse does not work
1.
2.
It shows AM/PM because the corresponding Time format is set in your operating system (Control Panel > Region and Language > Formats > Additional settings > Time). Please refer to this thread to find out the ways to change the NLS settings. For example (application level NLS setting):kiki wrote:I was trying to parse a string to OracleTimeStamp. I found if I use the format string "MM/DD/YYYY HH:MI:SS.FF", it always show PM
Code: Select all
OracleGlobalization glob = OracleGlobalization.GetApplicationInfo();
glob.TimeStampFormat = "HH:MI:SS.FF";
OracleGlobalization.SetApplicationInfo(glob);
OracleTimeStamp ts = OracleTimeStamp.Parse("12/23/2011 12:01:38.99 AM", "MM/DD/YYYY HH:MI:SS.FF", OracleDbType.TimeStamp);
Console.WriteLine(ts.ToString());
We will investigate this behaviour and notify you about the results.kiki wrote:If I use "MM/DD/YYYY HH:MI:SS.FF AM", it flips AM to PM and PM to AM.
Please try the new build of dotConnect for Oracle v 6.30.145 Beta which includes the fix for the bug with OracleTimeStamp.Parse() for time format with AM/PM.
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with valid subscription only): http://secure.devart.com/ .
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with valid subscription only): http://secure.devart.com/ .