locked
Oracle date RRS feed

  • Question

  • User261516802 posted

    In Oracle Today_date datatype date. I tried all code but i can not insert data from Asp .net page.

    Insert into Client(Today_date) values(DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss"))

    Is giving error that "Month is invalid"

    I used all code like....
    DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss")
    DateTime.Now.ToString(new CultureInfo("en-GB"));
    to_date() function with format as "MM/dd/yyyy HH:MI:SS AM

    Now i want to know is there work around oracle that we can set Datatype date correct so we can insert from asp.net page date?

    I can not insert date from asp.net C# to oracle.

    Wednesday, September 14, 2011 4:17 PM

Answers

  • User-20777992 posted

    User this!!!

    DateTime.Now.ToString("dd/MMMM/yyyy hh:mm:ss")

    As Oracle takes full month name in the date format.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 14, 2011 5:14 PM
  • User-20777992 posted

    Oops!!!

    Sorry I forgot to replace '/' with '-'.

    Pl. use the following one.

    DateTime.Now.ToString("dd-MMMM-yyyy hh:mm:ss")

    One more thing...do you need to store time also? If not then you can try juss the following one.

    DateTime.Now.ToString("dd-MMMM-yyyy")

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 14, 2011 11:52 PM

All replies

  • User-20777992 posted

    User this!!!

    DateTime.Now.ToString("dd/MMMM/yyyy hh:mm:ss")

    As Oracle takes full month name in the date format.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 14, 2011 5:14 PM
  • User261516802 posted

    It is still giving error "ORA-01843: not a valid month "

    Wednesday, September 14, 2011 6:07 PM
  • User-20777992 posted

    Oops!!!

    Sorry I forgot to replace '/' with '-'.

    Pl. use the following one.

    DateTime.Now.ToString("dd-MMMM-yyyy hh:mm:ss")

    One more thing...do you need to store time also? If not then you can try juss the following one.

    DateTime.Now.ToString("dd-MMMM-yyyy")

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 14, 2011 11:52 PM
  • User269602965 posted

    INSERT INTO Client (Today_date) VALUES (SYSDATE)

    is an SQL statement,

    so use the Oracle SYSDATE function

    This creates an Oracle date-time equivalent to the .NET DateTime.Now function.

     

    Thursday, September 15, 2011 10:34 PM