Converting "minutes.seconds.milliseconds" to "seconds.milliseconds"
Hello
I have string (string a = 1.15.67) which represents time (minutes. seconds. milliseconds).
Which is the easiest way to get a Double which holds the above mentioned time, where minutes are converted to seconds (double b = 75.67)?
Should i convert the above mentioned String to a Date object first or is this not neccesary?
Edited by: user10496629 on 17.03.2011 14:03
jduprez wrote:
To be honest, my knowledge of FP arithmetic comes mostly from reading this forum, and I'm sure you contributed to such discussions in the past - so I'm surprised to read your arguments.
Except myself I would use integral types (int, or long to be conservative) to hold the number of seconds/milliseconds. I don't see what double would bring except inaccurracy that will build up when you add/combine multiple durations.Yeah, but given that he wants the end result to include a fractional piece, he's going to have inaccuracies anyway?
Not if he stores the number of milliseconds, and only formats it at display time.Oh, I see what you're saying now.
Still, unless he's dealing with very large scales, he can store as a double, format for display, and any inaccuracies will wash out in the format. That is, even though 12345.67 cannot be stored in a double, most likely he will be able to ignore that, store 12345.67000000001, and format it so that it displays as 12345.67.
Whether that or a separate integer piece representation is more appropriate depends on other requirements and use cases that the OP hasn't shared with us. :-)
>
And it's highly likely that the integer numbers of minutes, seconds, and millis that are represented individually will be exactly representable by double.
In fact, if he keeps millis and seconds in their expected ranges, it's guaranteed that they are, and the only possible parsing inaccuracy is in minutes, and even then, the entire range of int can be exactly represented, so it'd be an awful lot of minutes before he started losing precision there.Either I misunderstand you, or what you say is not correct:
System.out.println(0.1D+0.2D+0.3D);Results in:
0.6000000000000001
But when you format for display, you'll get 0.600.
Similar Messages
-
Firefox freezes every few minutes for a few seconds.
Firefox keeps freezing every few minutes, for a few seconds at a time. It's infuriating. It just happened right now while I was typing "infuriating". It's happened since I installed the Facebook Video Chat Plug-In, but I uninstalled that and it keeps happening.
Probably an over active security or "cleaning" program that's kicking in every few minutes and messing with Firefox.
-
HT1657 My movie won't play past two minutes and thirty-seven seconds. What do I do?
My movie won't play past two minutes and thirty-seven seconds. What do I do?
Hello Bdev15,
I would be concerned too if the songs I purchased from iTunes were not downloading to my iPhone. You have taken some great troubleshooting steps already, and thank you for providing the details of the steps you too. I have a few additional suggestions to get it downloaded to your iPhone.
First, I recommend checking to see if the download was interrupted:
If your download was interrupted using your iPhone, iPad, or iPod touch
From the Home screen, tap the iTunes app.
For iPhone or iPod touch, tap More > Downloads. For iPad, tap Downloads.
Enter your account name and password if prompted.
Tap the blue download arrow to resume.
iTunes: How to resume interrupted iTunes Store downloads
http://support.apple.com/kb/ht1725
If the songs still do not download, next I recommend downloading the songs when connected to another network. For example, if you are using the cellular network, you could switch to Wi-Fi, or you could try an alternate Wi-Fi network. Follow the steps in the section titled "iPhone, iPad, or iPod touch > Music" in the article below to download the songs:
Downloading past purchases from the App Store, iBookstore, and iTunes Store
http://support.apple.com/kb/ht2519
If you are still not able to download the songs, you can report an issue with these purchases using the steps in this article:
How to report an issue with your iTunes Store, App Store, Mac App Store, or iBookstore purchase
http://support.apple.com/kb/ht1933
Best,
Sheila M. -
Does Apple know about bug in Timer that shows minutes but counts down seconds?
I have a couple of times changed my timer from a few minutes down past zero to 59 or so to time out about an hour. But the timer, while still showing minutes count down seconds. This image is a captured screen shot as it is counting down seconds. But when I cancel the timer, I get which shows the 59 minutes I expected to get. If I press Start at this point, it will count down seconds. If I attempt to reproduce conditions, by going to 8 or 9 minutes, then canceling and going to 59 minutes, it works. It may be that you have to run the timer down to alarm and then try the lower setting.
Does Apple know about bug in Timer that shows minutes but counts down seconds?
How would we know? Call them and ask. -
G3 screen lights up every 18 seconds for 6 seconds while at rest? How can I stop that
A G3 lights up the screen every 18 seconds for 6 seconds while at rest. How do I stop this. Have turned off all the auto update, location find, etc I can find and it still lights the screen every 18 seconds. Battery taking a beating and can't use it for an entire day without a charge. This seems to be the culprit.
Help!
PaulReset, hold Home and Power buttons until iPhone restarts itself.
Clean dock port, use a clean dry toothbrush. Lint free cloth moistened with Isopropyll Alcohol.
Restore Firmware with iTunes. -
Firefox became very heavy on my system and it some pages freeze for a second or tow second however my processor 2.4 and ram 256 how can i fix it ?
== This happened ==
Every time Firefox opened
== after firfox 3 and later versioni think your RAM is so low, i have 3gb ram and has some problem when firefox opened and worked for many hours.
-
First Second to last second of a Day
First second to last second of the day
Hi
I must to return First Second to Last Second of a day, I tried
select to_date(to_char(trunc(sysdate),'dd/mm/yyyy hh24:mi:ss'),'dd/mm/rrrr hh24:mi:ss'),
to_date(to_char(trunc(sysdate),'dd/mm/yyyy')||'23:59:59','dd/mm/rrrr hh24:mi:ss')
from dualIs there other way ?like this ??
SQL> set pages 500
SQL> alter session set nls_date_format = 'dd-mm-yyyy hh24:mi:ss';
Session altered.
SQL>
SQL> select trunc(sysdate) + level/(24*60*60) dt
2 from dual
3 connect by level <= 24*60*60;
DT
22-07-2008 00:00:01
22-07-2008 00:00:02
22-07-2008 00:00:03
22-07-2008 00:00:04
22-07-2008 00:00:05
22-07-2008 00:00:06
22-07-2008 00:00:07
22-07-2008 00:00:08
22-07-2008 00:00:09
22-07-2008 00:00:10
: -
Hi..
I have an issue in building the OBIEE repositoryin Administration tool.
I have a column of minutes (24hrs X 60 = 1440 mins in a day) as its values.
I need to build a column of Time ( convert minutes into time) using existing column of minutes.
Say 300 mins = 5:00AM (since -------> (60 X 5 =300))
315 mins = 5:15 AM
330mins = 5:30 AM
360mins = 6:00 AM.......so on in a day.
I appreciate your help.
Thank you.
Edited by: user11939829 on Aug 11, 2010 9:00 AMHi,
In Admin Tools, if you want to create a new colume as time(HH:MM), you can do it like this:
1. in "Business Model and Mapping", in the table which you want, create a logical column "Time"
2. Check the checkbox "Use exist logical column as the source"
3. In the expression builder, write the formula to convert minutes to time, like:
concat(concat(cast (minutes/60 as varchar(2)) , ':'), cast(mod(minutes,60) as varchar(2)))
Hope this helps you
Marc -
Premiere Elements 4.0 - How do I change all the clips from 5 seconds to 2 seconds in length?
Christine,
The Duration of Stills is set with Edit>Preferences to the number of Frames required, where ~ 30 Frames = 01 sec. of Duration.
Unfortunately, the Duration cannot be reset (Edit>Preferences) for material that has already been Imported. The procedure is to Delete those Imported Stills, and make the change, then re-Import them, and you will get the Duration that you have reset.
The only other option at this point is to manually Click-drag on the Head, or Tail of each Still in the Timeline, to adjust the Duration. I do this with the Info Panel open and visible to make it easier. Personally, unless I am well into the editing process, the Delete, change and re-Import option is my choice.
Good luck,
Hunt
PS - the ability to alter the Duration en masse for Imported Stills in the Project Panel has just been added in PrPro CS5. I do not know if it has been added in PrE 9 though. -
My MacBook Air is making a clicking noise every 7 seconds for 2 seconds. It started today, and I have had the computer for almost a year. It is below the power switch and annoying enough that it is hard to even work with the computer. It sounds as if a hard drive is trying to work. No applications running. Ideas?
If its a MBA with solid state drive then I would guess its the fan touching something ???. I think it have no other moving parts.
-
Milliseconds to Seconds Minutes
is there a way to take a number (specifically the position in
milliseconds that a sound has been playing) and convert it into
minute:second format? any help?
jeffHi Jeff
Here a code snippet that I'm using for my flash mp3 player.
function timer(sound_obj) {
time = sound_obj.position/1000;
min = Math.floor(time/60);
min = (min<10) ? "0"+min : min;
sec = Math.floor(time%60);
sec = (sec<10) ? "0"+sec : sec;
timeDisplay_txt.text = min+":"+sec+"/"+totalDuration;
function duration() {
timed = _root.sound_mc.sound_obj.duration/1000;
mind = Math.floor(timed/60);
mind = (mind<10) ? "0"+mind : mind;
secd = Math.floor(timed%60);
secd = (secd<10) ? "0"+secd : secd;
totalDuration = mind+":"+secd;
keep in mind to create a textfield with the instancename of
"timeDisplay_txt" and to call the timer function at least every
second using the setInterval statement.
Tiago -
Problem in converting the date format in Second's place
I am developing an application using OAF in JDeveloper.
I have to pass the current date from my page to a quary to filter the data.
I used the following:
String PresentDate=this.getOADBTransaction().getCurrentDBDate().toString();
However it is sending a date like '2011-03-22 17:04:14.0'. Here if you see the seconds place, it has a fraction as well.
I need to convert it by using TO_DATE(PresentDate, 'YYYY-MM-DD HH24:MI:SS')
But because of the fraction in Seconds place, it gives an error.
Can anyone help me to solve this problem?
Thanks & Regards
HawkerHawker,
Instead of that use..
//Calling dateValue( ) does not include time.
long sysdate = transaction.getCurrentDBDate().dateValue();
Regards,
Gyan -
Mac screen goes black every 2-3 minutes, returns after 1 second, Mavericks
My MAC, updated to Mavericks, screen goes black every 2-3 minutes, for one second, then returns. Has anyone experienced this? How should I correct it?
SOLVED!!!!!
SO I did some more digging around and read ATI cards seem to overheat easily. I knew the fan was working, but after closer inspection I realised there was ALOT of built up dust on the card and clogging the fan and airflow. Blew it out with alot of compressed air, stuck it back in the Mac and BAM...no black screens. I tested it by streaming 6 video sources...doing 2 screen captures at once as well as watching a HD movie in fullscreen. Did all this for 30 minutes and no crashes. I also downloaded an app to monitor the temps inside the computer and the expansion bay stays at 41 degrees. No clue what it was before but obviously it was hotter than that. So my problem is solved! Funny that 10.7.5 made the card work harder. I wonder if its off loading some CPU stuff to the GPU for processing more than 10.7.4 so its just working a bit harder and so it heats up faster.... -
Converting HH24:MI:SS to seconds Issue
Hallo Everyone,
I’m fairly new (read: about 2 days) to the whole PL/SQL world and I’ve run into a little problem with one of my projects. I’ve googled and looked around the forums and tried to apply what I have picked up but so far without much success.
The general situation is as follows:
I am creating a .bat file which will take data from a comma separated file and “upload” the data into a table of my choosing. However, in the file I’m trying to “upload”, one of the columns contains a time value of the type HH24:MI:SS (for example: 0:05:32). The column sequence in the file matches that of my table and the .bat file.
My standalone table for testing this conversion looks like this:
Table: Conversion_Test
Column Name Data Type
AUTO_ID NUMBER (12)
TIME NUMBER (12)
WORKING VARCHAR2 (32 Byte)
UPLOAD_DATE DATE
The columns AUTO_ID and UPLOAD_DATE are filled by triggers which have been tried, tested and found to be working just fine. My test file contains 1 row of raw data (no headers or other information is present).
I have managed to convert the HH24:MI:SS into seconds through the SQL*Plus interface with the following query:
SELECT
sysdate, to_number(substr('00:05:32',1,2)*3600 + substr('00:05:32',4,2)*60 + substr('00:05:32',7,2))
from dual
Which returns the correct result:
SYSDATE
TO_NUMBER(SUBSTR('00:05:32',1,2)*3600+SUBSTR('00:05:32',4,2)*60+SUBSTR('00:05:32
23-10-08
332
Potential Relevant Content off .bat file (not all of it):
LOAD DATA
INFILE "dat\%date%.dat"
Append
INTO TABLE Conversion_Test
FIELDS TERMINATED BY ';'
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*
Working
* XXXXXXXX = Location of relevant statement.
I have tried duplicating the results from my sysdate query with the following statements:
1. Time "to_number(substr('Time',1,2))*3600" + "to_number(substr('Time',4,2))*60" + "to_number(substr('Time',7,2))",
This generates the following error message:
SQL*Loader-350: Syntaxiserror in row 7.
"," of ")" expected, "+" found.
Time "to_number(substr('Time',1,2))*3600" + "to_number(substr('Time' ^
2. Time “to_number(substr('Time',1,2))*3600 + to_number(substr('Time',4,2))*60 + to_number(substr('Time',7,2))",
3. Time "to_number(substr('Time',1,2))*3600 + (substr('Time',4,2))*60 + (substr('Time',7,2))",
These generate the following error message:
Record 1: denied – error in table CONVERSION_TEST, Column TIME.
ORA-01722: invalid number
4. Time "to_number(substr('Time',1,2))*3600 + (substr('Time',4,2))*60 + (substr('Time',7,2)) from dual",
This generates the following error message:
Record 1: denied – error in table CONVERSION_TEST, Column TIME.
ORA-00917: missing comma
Question: What I want to do is convert this HH24:MI:SS “format” into seconds and then put them into a numbers column in my table by running the .bat file.
I hope I have provided enough information to give you a good insight into the problem and potential solutions.
With regards,
Luhaine
Edited by: user10465140 on 23-okt-2008 7:28
Edited by: user10465140 on 23-okt-2008 7:30
Edited by: user10465140 on 23-okt-2008 7:30
Edited by: user10465140 on 23-okt-2008 7:33 - Clearafication and Clean up.This keep getting weirder and weirder.
The reason why I am using a .bat file is because the end user of this little upload procedure is going to be someone who's SQL capabilities are that of a monkey (at best). So it needs to be relativly simple (think basic console window where one has to put in his password before uploading starts).
In the .bat file I basicly echo every line to the control file and establish a connection with username to the database where the target table is located. See below for snippets from the .bat file. Inspired with new hope that you managed to pull it off I went forth and replicated your table and query. Alas to no avail.
I use the same source data.
.dat file:
0:05:32
23:43:23
22:43:23
10:00:00
11:00:00
12:00:00
7:20:00 I use basicly (don't see why or how the difference could create this problem) the same ctl file:
echo LOAD DATA >>loaddata.ctl
echo INFILE "dat\%date%.dat" >>loaddata.ctl
echo Append >>loaddata.ctl
echo INTO TABLE Conversion_Test >>loaddata.ctl
echo FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS >>loaddata.ctl
echo ( >>loaddata.ctl
echo ACTUAL >>loaddata.ctl
echo ,secs "to_number(to_char(to_date(:ACTUAL, 'HH24:MI:SS'), 'SSSSS'))" >>loaddata.ctl
echo ) >>loaddata.ctl
echo off
cls
echo Enter your database password:
sqlldr userid=xxxx@yyyy control=loaddata.ctl log=log\Data_Extract_Nummer_Periode_%date%.log
echo on
{code}
The same table build.
{code}
Naam Null? Type
ACTUAL VARCHAR2(10)
SECS NUMBER
{code}
This is what I get :(
{code}
ACTUAL SECS
0 0
2 7200
2 7200
1 3600
1 3600
1 3600
7 25200
{code}
So I'm clueless as to why you would get the proper results and I'm stuck with these weird ones.
I've been on track to another possible sollution to the issue by using the replace and ldap function to remove the "":" from the time, supplement it to a 6 digit number, then use positions to calculate the total amount of seconds. I've only begun exploring this one a while ago.
PS. How do you format your tables so nicely without them going haywire with the ultra amoutn of breaks additions that rich text mode seems to do.
Edit:
I've just spotted something. The line:
FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
Is not getting echo'd to the control file. Could this be causing the problem? -
Converting 1/00 of a second to HH:MM:SS
In my PL/SQL statement, I'm using the following fuction DBMS_UTILITY.GET_TIME to get the starting and ending times of a sql process. It works fine but it returns the value in 1/100 of a second or microseoncds. Has anyone come up or know of a function that converts those microseconds to HH:MM:SS?
Thanks!
GlennIf your desired time granularity is to the whole second, just use SYSDATE instead of DBMS_UTILITY.get_time. DBMS_UTILITY.get_time merely returns the 1/100 second difference from some arbitrary point in time.
DECLARE
timer DATE := SYSDATE;
BEGIN
-- do some stuff
DBMS_OUTPUT.put_line( SYSDATE - timer );
-- which will return the floating point value where 1 = one day
END;Michael
Maybe you are looking for
-
Problem with creating and displaying images in a thread
Hi everyone, i need some bit of advice (of course otherwise i wouldn't write anything here). My situation is like this: I have a JFrame where the user can enter a string. Then a file that corresponds to this string is read and the information is stor
-
My mac pro has died, how can I see my emails on my macbook
My Mac Pro has died. I intend to get it repaired, obviously, but I need to see my emails from the many years of emails archived on its undamaged hard drive. I have removed the hard drive and connected it to my macbook using a USB carrier. I can find
-
I can't sign in or out of iCloud. Forgot the password to an email address I no longer have access to. What next? From what I'm reading in the forums, once the email address is set up it cannot be changed. True? If so, um, stupid. Message to log
-
How can i change backgroud color in Java ME Platform SDK 3?
Hello. Yesterday i had donwloaded Java ME Platform SDK 3.0. It is IDE based on NetBeans core, but i didn't find any facility to change default colors. (NetBeans have option to change color theme). I am don't like working when background color is whit
-
I click on Fill & Sign Tools, then I click Place Signature. The instructions show a dialog box with four options however that does not happen. I am only presented with the option of importing a digital signature. How do I get to the option of importi