Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8464627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:48:21+00:00 2026-06-10T14:48:21+00:00

I want to make Oracle return dates using .NET’s Universal Sortable Time format so

  • 0

I want to make Oracle return dates using .NET’s Universal Sortable Time format so that I can consistently use this rather nice date/time format and so I can easily parse the result to a DateTime simply using “u” as the format:

// "u" is less unwieldy than "yyyy'-'MM'-'dd HH':'mm':'ss'Z'"
myDT = DateTime.ParseExact(oraString, "u", CultureInfo.InvariantCulture);

I can easily make Oracle return this format:

SELECT to_char(sysdate, 'YYYY-MM-DD HH:MM:SS') || 'Z' udt FROM dual

However, the ‘Z’ added with concatenation would make the query unable to practically use a bind variable for the format:

someBindMethod("uformat", "YYYY-MM-DD HH:MM:SS"); // Hypothetical .NET/Oracle lib

-- No matter the format string, date/time will always end with 'Z'.
SELECT to_char(sysdate, :uformat) || 'Z' udt FROM dual

(Oracle complains if the ‘Z’ ends the format string)

How do I pass a bind string such that I can return the universal sortable time format, but can still use any other date format without altering the query?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:48:22+00:00Added an answer on June 10, 2026 at 2:48 pm

    (Q&A format self-answer): You can add arbitrary strings using double-quotes within the bind variable or within the single-quoted Oracle SQL text, e.g.:

    SELECT to_char(sysdate, 'YYYY"SOMESTRING"') foo FROM dual
    -- returns "2012SOMESTRING"
    

    I wasn’t aware of this feature, and it was a little tricky to find at least in the context of my searches.

    Now you can bind any format but still get the ‘Z’ ending on the universal format:

    const string oraUniversalFormat = "YYYY-MM-DD HH:MM:SS\"Z\"";
    const string anyOtherFormat = "YYYY"; // use later
    someBindMethod("uformat", oraUniversalFormat);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using c#.net with an Oracle database. I want an example of how
Time for my first question! I want to make it known that I'm quite
I want to make Java code (using Oracle 11g and JDBC also) which will
I just want to make it sure that this ODP.NET is the native provider
I want make datetimepicker in my project. Using jquery how it is possible? I
I want make interactive application where user launches it and can do various task
I am traversing a HTML document using javascript DOM. I want make a list
I want to do following: Make Oracle stored procedure for read all data from
I want to make an incremetal script for my oracle database. I want to
i want to make some tests with the Oracle Business Intelligence Webservices. First i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.