Page 1 of 1

OracleTimeStamp.Parse does not work

Posted: Tue 19 Apr 2011 23:25
by kiki
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!

Posted: Wed 20 Apr 2011 13:29
by Shalex
1.
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
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):

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());
2.
kiki wrote:If I use "MM/DD/YYYY HH:MI:SS.FF AM", it flips AM to PM and PM to AM.
We will investigate this behaviour and notify you about the results.

Posted: Wed 20 Apr 2011 14:31
by Shalex
We have fixed the bug with OracleTimeStamp.Parse() for time format with AM/PM. I will post here when the corresponding build of dotConnect for Oracle is available for download.

Posted: Wed 20 Apr 2011 22:36
by kiki
Thanks Shalex. That's quick fix :D Let me know when the next release is ready.

Posted: Wed 27 Apr 2011 12:25
by Shalex
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/ .