OracleTimeStamp.Parse does not work

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
kiki
Posts: 7
Joined: Wed 23 Mar 2011 21:05

OracleTimeStamp.Parse does not work

Post by kiki » Tue 19 Apr 2011 23:25

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!

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 20 Apr 2011 13:29

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.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 20 Apr 2011 14:31

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.

kiki
Posts: 7
Joined: Wed 23 Mar 2011 21:05

Post by kiki » Wed 20 Apr 2011 22:36

Thanks Shalex. That's quick fix :D Let me know when the next release is ready.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 27 Apr 2011 12:25

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/ .

Post Reply