8

Convert Elapsed Time to One Decimal in Oracle

 2 years ago
source link: https://www.codesd.com/item/convert-elapsed-time-to-one-decimal-in-oracle.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Convert Elapsed Time to One Decimal in Oracle

advertisements

When performing the below calculation (end_time minus start_time) in Oracle you get a result of +00 01:30:00.000000. How can that result be converted to 1.50?

to_timestamp(to_char(end_time,'HH:MI AM'), 'HH:MI AM') -
to_timestamp(to_char(start_time,'HH:MI AM'), 'HH:MI AM')


Try something like this:

select dat,extract(hour from dat) ||'.'||trunc(100*extract(minute from dat)/60,0) result from
(select to_timestamp('04:30 AM', 'HH:MI AM') - to_timestamp('03:10 AM', 'HH:MI AM') as dat from dual union all
select to_timestamp('02:30 AM', 'HH:MI AM') - to_timestamp('02:00 AM', 'HH:MI AM') as dat from dual)

Results:

DAT                                               RESULT
--------------------------------------------------------------------------------
+00 01:20:00.000000                                1.33
+00 00:30:00.000000                                0.50

Tags oracle

Related Articles

How do you convert dates / times from one time zone to another in R?

If I have a date like this in London time: "2009-06-03 19:30", how can I convert it to the equivalent time in the US West Coast?Change the tzone attribute of a 'POSIXct' object: > pb.txt <- "2009-06-03 19:30" > pb.date <- a

What is the best way to store elapsed time in a database

I working on a horse racing application and have the need to store elapsed times from races in a table. I will be importing data from a comma delimited file that provides the final time in one format and the interior elapsed times in another. The fol

How can I do something after Elapsed Time in Android?

I am new in programming. I want to turn off wifi after 2h (I know how to turn it off) in the background I googled and found out, that the Elapsed Real Timer is needed for that. I have also find this code and implemented it (this is the only code I ha

How do I convert to DateTime when the time is a decimal?

I have a data table, from Sage 100 ERP to be specific, that uses two separate columns to store the updated date and time (DateUpdated and TimeUpdated). I need to convert the data in these two fields to a DateTime object for comparisons. The dates loo

Convert MSSQL time with decimal precision in PHP Time and MySQL DateTime

I am trying to convert MSSQL time into PHP time and then MySQL datatime. MSSQL time format looks like this. 2011-10-07 16:55:37.337 I want to insert this exact representation into MySQL database. To achieve this, I am using PHP. date('Y-m-d H:i:s', s

Decode and convert VARCHAR time in Oracle

I need to query particular column in DB w/c is described as VARCHAR that I need to convert into Time Format (HH:MM) and then decode to its range value, to explain further... The column stores data when (time) a particular deal was made w/in the day a

Conversion of LAT LONG coordinates of the string to an elapsed time value

I can retrieve values from our database at work that represent coordinates. I use SQL to retrieve the data and open the results in Excel. They're stored to appear as coordinates in the degrees format, e.g. DDMMSS for LAT and DDDMMSS for LONG. The exc

How to convert the period into a decimal value into something more friendly with Regex for the new

All I am trying to figure out is a way to convert the period in a decimal to be -point- for SEO purposes. I was trying a Regex.Replace like: Regex.Replace(URLVariableString, "[\d][.][\d]", "-point-") The only problem with this is that

IOS - How do I convert float time in real time (hh: mm)

I'm calculating the average travel time from one point to another by using the following calculation: float tSpeed = [[NSString stringWithFormat:@"%f", speed] floatValue]; float duration = totDistance/tSpeed; tripDuration_Label.text = [NSString

Unable to link to gettimeofday on the embedded system, suggestions of elapsed time?

I am trying to use gettimeofday on an embedded ARM device, however it seems as though I am unable to use it: gnychis@ubuntu:~/Documents/coexisyst/econotag_firmware$ make Building for board: redbee-econotag CC obj_redbee-econotag/econotag_coexisyst_fi

Java System.nanoTime () huge difference in elapsed time

I'm in and android widget and checking elapsed time between two calls of System.nanoTime() and the number is huge. How do you measure elapsed time with this? it should be a fraaction of a second and instead its much more. ThanksThe System.nanoTime()

SEGV error in test C code on elapsed time in ARM Cortex M4 processor

I'm writing a code for embedded OS for my stm32f429 board. I'm testing this code for elapsed time: #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include <fcntl.h> #include <time.h> #include <stdint.h> #d

Php mysql elapsed time

I have an app [iphone], that sends to a server some times [using json], so the times look like hh:mm 24 hour format, the time gets saved in the db as varchar, I need to calculate the elapsed time = endTime - startTime but my problem is that I have th

The text box accepts only the number and one decimal in wpf

I need my text box to accept only number with one decimal point. I created a function to accept only numeric value. Now I need a help for accept only one decimal point: private void txtOpenBal_PreviewTextInput(object sender, TextCompositionEventArgs

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK