Insert time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mjawadkhatri
    New Member
    • Jul 2009
    • 1

    Insert time

    how to insert time in oracle database????
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    I'm not much on proper use of databases... but doesn't that depend on the database you've created? Maybe you are storing the date as a string to be parsed later... maybe as three ints for day, month, year.

    Any experts with more experience that can educate the both of us?

    Comment

    • cloud255
      Recognized Expert Contributor
      • Jun 2008
      • 427

      #3
      Hi

      Well in the most basic form you will execute an INSERT INTO statement, but as tlhintoq pointed out you have to use the correct formatting.

      You will most probably build the datetime value in C# and pass it to Oracle via a database adapter or if you simply want to log when something happened you could create a trigger and not use C# at all.

      You need to be more specific and let us know what you have done so far and what you would ultimately like to achieve.

      Comment

      • artov
        New Member
        • Jul 2008
        • 40

        #4
        You have also decide if you mean the time on the client or the server. If you are using the time in the client, you should use DateTime in C#, something like

        string time = DateTime.Now.Ti meSpan.ToString ();
        But if you mean server time, you should use
        TO_CHAR(current _date, 'HH:MM:SS')
        So what is the difference? If the database and client are on the same computer, no much. But if there are several PCs as client, their clock differ somewhat, so it is better to use common clock, and server's clock seems to be suitable (or NTP).

        Comment

        Working...