Add time to a field

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc

Poston Tue, 30 Jan 2007 11:49 pm

Guys, I have a table that contains a field of type date and the data are of the following format: 5/10/2007 10:10, how do I add the hours of these compos.
Location: São Paulo - SP

Poston Mon, 05 Feb 2007 2:27 pm

The only way to add time is turn them into numbers before adding. Example: 12:0 + 6:0 = 6:0 pm You turn 12:0 on amount of days: 12:0 = 0.5 6:0 = 0.25 days days---------------total 0.75 days--> multiply by 12:0 am, and has 18!

It is clear that the procedure that converts the DATE to NUMBER should also consider the minutes.
But that's the way: after converting hours to number, you can add, reduce, etc..

You have to also create a procedure that converts numbers to TIME. (if not, the user will see instead of 0.75 6:0 pm)
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?

  • See also
    Last Post

      Return to SQL

      Who is online

      Users browsing this forum: No registered users and 4 guests