Calculating elapsed time (in minutes) from a TIMESTAMP field in a table
I have a table of events that contains a field, CREATION_DATE, that is defined as NOT NULL TIMESTAMP(6), and the value is normally in the format 'DD-MON-YYYY HH:MM:SS.FFFFFF xM'. I want to SELECT only those rows where the elapsed time between the CREATION_DATE and the local time (US/EASTERN) is greater than 15 minutes. And, I'd like the output to show the values for the elapsed time in days, hours, minutes, and seconds.
Edited by: user12301147 on Dec 2, 2009 9:16 AM
Hi,
It looks like to have to adjust for time zones.
I'm not sure what you mean by "2009-DEC-02 13:59:34.316, which is in actual time 2009-DEC-02 08:59:34.316." Aren't both actual times, just in different time zones? I'm also a lttle confused about the results: even if it's treating 6 hours 18 minutes as 0 hours 18 minutes, either way it's over 15 minutes.
Convert either creation_date or SYSTIMESTAMP to the time zone of the other. (It looks like SYSTIMESTAMP is indeed Eastern Time, UTC - 5:00).
Or, if they are always a fixed time apart, build that difference into the comparison. for example:
WHERE SYSTIMESTAMP - creation_date > TO_DSINTERVAL ('-0 05:45:00')
Similar Messages
-
Calculating Elapsed Time Is Off By One Hour
I am fully aware of many topics discussed in the various forums here related to the OS timezone and DST settings impacting how the JVM will process date/time calculations. I am running on Windows XP Professional, and I have checked and double checked the timezone setting, it is correctly set to Central Time and the "Automatically adjust clock for daylight saving changes" checkbox is checked.
The code found at the end of this message clearly shows the problem for which I have yet to find an explination. I intended to be able to use a timer to update a string to show how much time has elapsed since the start of anything for which I need to know this information. As you can see by the results (example of which is listed after the code), the timezone and DST offsets seem to be properly retrieved by the JVM, but if this is the case, then why is the elapsed time value off by one hour?
I am looking for a solution/explanation involving the date/time classes, not a workaround whereby I end up extracting multiple time representation subsets and manipulating them myself. Any help will be greatly appreciated.
* TestTimeZone.java
* Created on September 12, 2004, 7:18 PM
import java.io.*;
import java.util.*;
import java.awt.event.*;
import java.sql.*;
import java.text.*;
* @author Jared
public class TestTimeZone {
java.util.Date startDt;
/** Creates a new instance of TestTimeZone */
public TestTimeZone() {
* @param args the command line arguments
public static void main(String[] args) {
new TestTimeZone().go();
private void go() {
startDt = new java.util.Date();
TimeZone tz = TimeZone.getDefault();
System.out.println("the default timezone is " + tz.getDisplayName(true, TimeZone.LONG));
System.out.println("the default timezone ID is " + tz.getID());
System.out.println("useDaylightTime = " + tz.useDaylightTime());
System.out.println("default locale = " + Locale.getDefault().toString());
javax.swing.Timer t = new javax.swing.Timer(1000, new ActionListener() {
public void actionPerformed(ActionEvent ae) {
java.util.Date currDt = new java.util.Date();
Calendar cal = Calendar.getInstance();
long elapsedTime = currDt.getTime() - startDt.getTime() -
(cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET));
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
System.out.println("Elapsed: " + formatter.format(new java.util.Date(elapsedTime)) +
" Start: " + formatter.format(startDt) +
" Current: " + formatter.format(currDt));
t.start();
while (true) try {
Thread.sleep(10);
} catch (Exception e) {
e.printStackTrace();
}And here is the result I am seeing:
the default timezone is Central Daylight Time
the default timezone ID is America/Chicago
useDaylightTime = true
default locale = en_US
Elapsed: 23:00:01 Start: 00:03:57 Current: 00:03:58
Elapsed: 23:00:02 Start: 00:03:57 Current: 00:03:59
Elapsed: 23:00:03 Start: 00:03:57 Current: 00:04:00
Elapsed: 23:00:04 Start: 00:03:57 Current: 00:04:01
Elapsed: 23:00:05 Start: 00:03:57 Current: 00:04:02
"Great. Now that we have gotten half way to the goal, please let me know how you intend to get that difference in miliseconds presented as a time value using any of the date/time classes Java has to offer. That way, I don't have to rewrite the code that puts it into a properly formatted String (the kind folks at Sun have already written that code). Using date/time classes to acheive this is what I attempted with my application. I added the milisecond adjustments for TZ and DST because if I didn't the reported elapsed time would be off by 6 hours, not just 1.
I am open to all suggestions. -
Adding a timestamp field to a table (MySQL database)
I've defined a field in a MySQL table as type 'timestamp'
eg. 2010-05-25 21:36:19
When I perform an insert using coldfusion, the row doesn't change the value in the timestamp automatically
Am I better creating my own timestamp field, type varchar and manually insert my timestamp values ?No, it is a pretty bad idea to use a text field to store date-time information. It makes it much harder to do date and|or time calculations on the data.
A timestamp field does not mean you have a field that automatically inserts a timestamp on record insert and|or update. Just that you have a field that expects a 'timestamp' value which is usually a date-time value down to the millisecond precision.
You can set up the database to automatically create this value when data is inserted and|or updated, but that is more then just creating the timestamp field. And the specifics will change depending on your exact database management system. Searching the internets for information on your database managerment system of choice and auto and|or default values for fields should guide you in the correct direction.
Or you can insert timestamp data along with the other data you are inputting into the database. The now() function combined with the <cfqueryparam value="#timeData#" cfsqltype="cf_sql_timestamp"> is a useful combination to do this. -
Storing the Timestamp field in the Table
Hi
I have a Z program and we need to store the timestamp field in the Z table . I have created the table with the dataelement
TIMESTAMP . Is there any system field that can be used to store the timestamp field from your program
say for example we have declared a work area of the structure of the Z table and Appended through the Internal Table and Modified that Z table.
My intention is store the Timestamp field in the Z table.
NadeshHi,
you can add as below..
types : begin of st_output.
include structure ztaxinvoice.
FKIMG1 TYPE VBRP-FKIMG,
FKIMG2 TYPE VBRP-FKIMG,
types : end of st_output.
or you can add this field to your structure 'ztaxinvoice' as below
'FKIMG1 TYPE FKIMG'
'FKIMG2 TYPE FKIMG'
Then you can declare internal table and work area as mentioned below..
data: it_output type standard table of ztaxinvoice,
wa_output type ztaxinvoice.
here in this case no need of types declaration also you can pass the same type (wa_output type ztaxinvoice) in smartform.
hope this will help you,
Regards,
Renuka S. -
Elapsed time went up from 1min to 22min after migrating from 10g to 11g
I just migrated one of my database from 10.2.0.2(Red hat Linux, 2 node RAC, sga= 1Gb) to 11.2.0.1 (red Hat Linux 2 Node RAC, SGA=7GB)
The timing for one of the specific query shoot up from 1min to 22 min.
Following is the query:
SELECT /*+ gather_plan_statistics */ docr.DRCONTENT
FROM WRPADMIN.T_DOCREPORT docr, WRPADMIN.t_document doc
WHERE doc.docid = docr.docid
AND 294325 = doc.rdocid
AND ( ( ( (EXISTS
(SELECT 'X'
FROM WRPADMIN.t_mastermap mstm1,
WRPADMIN.t_docdimmap docdim1
WHERE doc.docid = mstm1.docid
AND mstm1.dimlvlid = 2
AND mstm1.mstmapid = docdim1.mstmapid
AND docdim1.dimid IN (86541))))
OR (EXISTS
(SELECT 'X'
FROM WRPADMIN.t_mastermap mstm2,
WRPADMIN.t_docdimmap docdim2
WHERE doc.rdocid = mstm2.rdocid
AND mstm2.dimlvlid = 1
AND mstm2.mstmapid = docdim2.mstmapid
AND docdim2.dimid IN (28388)))))
ORDER BY doc.DOCIDThe select field (docr.DRCONTENT) is a CLOB column.
Following is the plan and statistics in 10g
Statistics
1 recursive calls
0 db block gets
675018 consistent gets
52225 physical reads
0 redo size
59486837 bytes sent via SQL*Net to client
27199426 bytes received via SQL*Net from client
103648 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
51823 rows processed
SQL>
Plan hash value: 129748299
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads | OMem | 1Mem | Used-Mem |
| 1 | SORT ORDER BY | | 1 | 50 | 51823 |00:00:14.72 | 627K| 5379 | 26M| 1873K| 23M (0)|
|* 2 | FILTER | | 1 | | 51823 |00:00:08.90 | 627K| 5379 | | | |
| 3 | TABLE ACCESS BY GLOBAL INDEX ROWID | T_DOCREPORT | 1 | 1 | 51823 |00:00:05.42 | 159K| 3773 | | | |
| 4 | NESTED LOOPS | | 1 | 50 | 103K|00:00:12.65 | 156K| 628 | | | |
| 5 | TABLE ACCESS BY GLOBAL INDEX ROWID | T_DOCUMENT | 1 | 50 | 51823 |00:00:00.15 | 481 | 481 | | | |
|* 6 | INDEX RANGE SCAN | RDOC2_INDEX | 1 | 514 | 51823 |00:00:00.09 | 245 | 245 | | | |
|* 7 | INDEX RANGE SCAN | DOCID9_INDEX | 51823 | 1 | 51823 |00:00:00.46 | 155K| 147 | | | |
|* 8 | TABLE ACCESS BY GLOBAL INDEX ROWID | T_DOCDIMMAP | 51823 | 1 | 0 |00:00:04.52 | 467K| 1140 | | | |
| 9 | NESTED LOOPS | | 51823 | 1 | 207K|00:00:03.48 | 415K| 479 | | | |
|* 10 | TABLE ACCESS BY GLOBAL INDEX ROWID | T_MASTERMAP | 51823 | 1 | 51823 |00:00:01.20 | 207K| 190 | | | |
|* 11 | INDEX RANGE SCAN | DOCID4_INDEX | 51823 | 1 | 51824 |00:00:00.41 | 155K| 146 | | | |
|* 12 | INDEX RANGE SCAN | MSTMAPID_INDEX | 51823 | 1 | 103K|00:00:00.43 | 207K| 289 | | | |
|* 13 | TABLE ACCESS BY GLOBAL INDEX ROWID | T_DOCDIMMAP | 1 | 1 | 1 |00:00:01.05 | 469 | 466 | | | |
| 14 | NESTED LOOPS | | 1 | 1 | 15 |00:00:14.62 | 468 | 465 | | | |
|* 15 | TABLE ACCESS BY GLOBAL INDEX ROWID| T_MASTERMAP | 1 | 1 | 1 |00:00:01.02 | 464 | 463 | | | |
|* 16 | INDEX RANGE SCAN | RDOCID3_INDEX | 1 | 629 | 44585 |00:00:00.29 | 198 | 198 | | | |
|* 17 | INDEX RANGE SCAN | MSTMAPID_INDEX | 1 | 1 | 14 |00:00:00.02 | 4 | 2 | | | |
Predicate Information (identified by operation id):
2 - filter(( IS NOT NULL OR IS NOT NULL))
6 - access("DOC"."RDOCID"=294325)
7 - access("DOC"."DOCID"="DOCR"."DOCID")
8 - filter("DOCDIM1"."DIMID"=86541)
10 - filter("MSTM1"."DIMLVLID"=2)
11 - access("MSTM1"."DOCID"=:B1)
12 - access("MSTM1"."MSTMAPID"="DOCDIM1"."MSTMAPID")
13 - filter("DOCDIM2"."DIMID"=28388)
15 - filter("MSTM2"."DIMLVLID"=1)
16 - access("MSTM2"."RDOCID"=:B1)
17 - access("MSTM2"."MSTMAPID"="DOCDIM2"."MSTMAPID")following is the plan in 11g:
Statistics
32 recursive calls
0 db block gets
20959179 consistent gets
105948 physical reads
348 redo size
37320945 bytes sent via SQL*Net to client
15110877 bytes received via SQL*Net from client
103648 SQL*Net roundtrips to/from client
3 sorts (memory)
0 sorts (disk)
51823 rows processed
SQL>
Plan hash value: 1013746825
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads | OMem | 1Mem | Used-Mem |
| 0 | SELECT STATEMENT | | 1 | | 51823 |00:01:10.08 | 20M| 2306 | | | |
| 1 | SORT ORDER BY | | 1 | 1 | 51823 |00:01:10.08 | 20M| 2306 | 9266K| 1184K| 8236K (0)|
|* 2 | FILTER | | 1 | | 51823 |00:21:41.79 | 20M| 2306 | | | |
| 3 | NESTED LOOPS | | 1 | | 51823 |00:00:01.95 | 8054 | 1156 | | | |
| 4 | NESTED LOOPS | | 1 | 335 | 51823 |00:00:00.99 | 4970 | 563 | | | |
| 5 | TABLE ACCESS BY GLOBAL INDEX ROWID | T_DOCUMENT | 1 | 335 | 51823 |00:00:00.38 | 402 | 401 | | | |
|* 6 | INDEX RANGE SCAN | RDOC2_INDEX | 1 | 335 | 51823 |00:00:00.17 | 148 | 147 | | | |
|* 7 | INDEX RANGE SCAN | DOCID9_INDEX | 51823 | 1 | 51823 |00:00:00.55 | 4568 | 162 | | | |
| 8 | TABLE ACCESS BY GLOBAL INDEX ROWID | T_DOCREPORT | 51823 | 1 | 51823 |00:00:00.94 | 3084 | 593 | | | |
| 9 | CONCATENATION | | 51823 | | 51823 |00:22:16.08 | 20M| 1150 | | | |
| 10 | NESTED LOOPS | | 51823 | | 0 |00:00:02.71 | 221K| 1150 | | | |
| 11 | NESTED LOOPS | | 51823 | 1 | 103K|00:00:01.19 | 169K| 480 | | | |
|* 12 | TABLE ACCESS BY GLOBAL INDEX ROWID| T_MASTERMAP | 51823 | 1 | 51823 |00:00:00.72 | 108K| 163 | | | |
|* 13 | INDEX RANGE SCAN | DOCID4_INDEX | 51823 | 1 | 51824 |00:00:00.52 | 56402 | 163 | | | |
|* 14 | INDEX RANGE SCAN | MSTMAPID_INDEX | 51823 | 2 | 103K|00:00:00.60 | 61061 | 317 | | | |
|* 15 | TABLE ACCESS BY GLOBAL INDEX ROWID | T_DOCDIMMAP | 103K| 1 | 0 |00:00:01.14 | 52584 | 670 | | | |
| 16 | NESTED LOOPS | | 51823 | | 51823 |00:22:13.19 | 20M| 0 | | | |
| 17 | NESTED LOOPS | | 51823 | 1 | 725K|00:22:12.31 | 20M| 0 | | | |
|* 18 | TABLE ACCESS BY GLOBAL INDEX ROWID| T_MASTERMAP | 51823 | 1 | 51823 |00:22:11.09 | 20M| 0 | | | |
|* 19 | INDEX RANGE SCAN | RDOCID3_INDEX | 51823 | 336 | 2310M|00:12:08.04 | 6477K| 0 | | | |
|* 20 | INDEX RANGE SCAN | MSTMAPID_INDEX | 51823 | 2 | 725K|00:00:00.83 | 51838 | 0 | | | |
|* 21 | TABLE ACCESS BY GLOBAL INDEX ROWID | T_DOCDIMMAP | 725K| 1 | 51823 |00:00:00.92 | 51823 | 0 | | | |
Predicate Information (identified by operation id):
2 - filter( IS NOT NULL)
6 - access("DOC"."RDOCID"=294325)
7 - access("DOC"."DOCID"="DOCR"."DOCID")
12 - filter("MSTM1"."DIMLVLID"=2)
13 - access("MSTM1"."DOCID"=:B1)
14 - access("MSTM1"."MSTMAPID"="DOCDIM1"."MSTMAPID")
15 - filter((INTERNAL_FUNCTION("DOCDIM1"."DIMID") AND (("DOCDIM1"."DIMID"=86541 AND "MSTM1"."DIMLVLID"=2 AND "MSTM1"."DOCID"=:B1) OR
("DOCDIM1"."DIMID"=28388 AND "MSTM1"."DIMLVLID"=1 AND "MSTM1"."RDOCID"=:B2))))
18 - filter(("MSTM1"."DIMLVLID"=1 AND (LNNVL("MSTM1"."DOCID"=:B1) OR LNNVL("MSTM1"."DIMLVLID"=2))))
19 - access("MSTM1"."RDOCID"=:B1)
20 - access("MSTM1"."MSTMAPID"="DOCDIM1"."MSTMAPID")
21 - filter((INTERNAL_FUNCTION("DOCDIM1"."DIMID") AND (("DOCDIM1"."DIMID"=86541 AND "MSTM1"."DIMLVLID"=2 AND "MSTM1"."DOCID"=:B1) OR
("DOCDIM1"."DIMID"=28388 AND "MSTM1"."DIMLVLID"=1 AND "MSTM1"."RDOCID"=:B2))))Calling all performance experts. Any ideas ??
Edited by: dm_ptldba on Oct 8, 2012 7:50 AMIf you check lines 2, 3, 8, and 13 in the 10g plan you will see that Oracle has operated your two EXISTS subqueries separately (there is a bug with multiple filter subqueries in that version that indents each subquery after the first one extra place, so the shape of the plan is a little deceptive). The statistics show that the second subquery only ran once because existence was almost always satistfied by the first.
In the 11g plan, lines 2, 3, and 9 show that the optimizer has transformed your TWO subqueries into a single subquery, then turned transformed the single subquery into a concatenation and this has, in effect, made it execute both subqueries for every row from the driving table - all the extra work appears from the redundant execution of the thing that was the second EXISTS subquery.
If you extract the OUTLINE from the execution plans (add 'outline' to the call to dbms_xplan as one of the format options) you may see some hint that shows the optimizer combining the two subqueries - if so then put in the "NO_xxx" hint to block it. Alternatively you could simply try adding the hint stop ALL cost-based query transformations /*+ no_query_transformation */
Regards
Jonathan Lewis -
Calculating Elapsed time over multiple days
Hello Community!
I am creating a logbook for our aircraft and attempting to correctly use the DUR2HOURS function to calculate flight times. DUR2HOURS does a great job of converting take off and landing times into decimal format but runs in to trouble when take off is late on one day and landing is on the next day. For example: Takeoff at 21:00 and landing at 01:00 gives a large negative number. I am using the very basic formula =DUR2HOURS([ldg time]-[takeofftime]) I realize that my equation will not work when we land on the next day. How can I modify my formula to correctly calculate a duration over multiple days? Thanks in advance for your help!if you enter the complete date and time then this should still work:
format the depart and arrival times:
You can then sum the durations as:
C13=SUM(C)
Rows 1 is a header and row 13 is a footer -
Multi instance of timestamp field in single table?
Is this statement true?
"Database does not allow multiple instances of this type if field in a single table"
To me this makes so sense and I would assume it would not matter how many you had.
Thoughts?Where did you get the error message? What was being done?
UT1 > set echo on
UT1 > @t13
UT1 > create table marktest2 (
2 fld1 number, fld2 varchar2(10), fld3 timestamp, fld4 timestamp)
3 /
Table created.
UT1 > desc marktest2
Name Null? Type
FLD1 NUMBER
FLD2 VARCHAR2(10)
FLD3 TIMESTAMP(6)
FLD4 TIMESTAMP(6)Ran on 9.2.0.6 running on AIX 5.2L
HTH -- Mark D Powell -- -
How to get the values from the input field of a table
Hello Friends
I am having table having one column as InputField and rest are the textview fields
I input the data and click the button that will add them to a node.
But what is happening is it is adding the current value to all the fields replacing other filelds.
Like suppose I am having 3 rows
In column I input 10
In column 2 input 20
In column 3 input 30
Now it is setting the value 30 to all the 3 fields.
Can any one tell me the code to set 10, 20 and 30 as different value in a node as entered by me.
ThanksHi
i am your scernario as follows
Context
TN_node (value node of cardinality 0:N)
val1 (value attribute under value node)
val2 (value attribute under value node)
i have binded Tn_node to table and val1 is textview and val2 is inputfield
public void wdDoInit()
//@@begin wdDoInit()
for(int i=0;i<5;i++)
IPrivateTestView.ITN_nodeElement ele=wdContext.nodeTN_node().createTN_nodeElement();
wdContext.nodeTN_node().addElement(ele);
ele.setVa1("val"+i);
//@@end
i have a button go in which printing all the values
public void onActionGo(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionGo(ServerEvent)
for(int j=0;j<wdContext.nodeTN_node().size();j++)
//IPrivateTestView.ITN_nodeElement
IPrivateTestView.ITN_nodeElement ele=wdContext.nodeTN_node().getTN_nodeElementAt(j);
wdComponentAPI.getMessageManager().reportSuccess("-----"+ele.getVa1());
wdComponentAPI.getMessageManager().reportSuccess("-----"+ele.getVa2());
Hope this helps,
If your problem is not solved please post your code like this
Thanks and Regards,
Arun -
How to get the value from the Input field of the Table view.
Hi Experts,
I have created a table view with 10 rows and each rows contains input fields in it.Can you please help me getting the values that are entered in all 10 rows.
Currently I am using the below code,but using the below I am able to get only the first row details of the table.
lo_el_table->get_static_attributes(
IMPORTING
static_attributes = ls_table).
Please let me know you suggestions on this.Thanks in advance.
Regards,
ArunHi Arun,
You should use this method:
lo_nd_table->get_static_attributes_table(
IMPORTING
table = lt_table).
Cheers,
Roelof
http://www.nl4b.com -
Calculating total time.
I'm somewhat new to using spreadsheets. Basically I just want to keep track of the time I spend doing a particular job. So I'm tracking my start time, end time, and then I want to calculate the total time spent. Thanks.
Yes, I thought about that. But if you start at say
9pm and end at 2am you would get the incorrect result
of 7 hours. I think I have to convert the time to
something else before the math takes place. But I'm
not sure how that would work.
I'm not sure how you managed to subtract 9pm from 2pm and get 7 hours. When I try 2am - 9pm, I get #VALUE!, as AppleWorks reads both 'times' as text, and cannot use Text values in a formula that requires numbers. AppleWorks is a bit fussy on what it considers to be a number.
Using the default alignment, you can recognize what AppleWorks thinks is a number—it will be aligned to the right of the cell—and what AW considers to be Text—it will be aligned to the left of the cell. In the case of Time, you're better off using the 24 hour clock, and entering one minute betore 2pm as 13:59.
The Mac clock's unit of time is the (24 hour) Day, and all times entered are regarded as the portion of one day that has elapsed up to that time. When you do the subtraction, the result is also a time of day. For start and end times within the same calendar day, simply doing the subtraction will give a result that can be read as the (correct) elapsed time. For the example times you gave, the 'correct' result is also visible:
02:00 - 21:00 = 05:00
But the actual numbers behind that 05:00 result and the two times used to get it are the portion of the current day that has passed up to each of the times entered, and the difference obtained when you do the subtraction:
0.0833 - 0.8750 = -0.7917
If you only want the (readable) result for a single day, that's not a problem. But if you want to add the results to get a total time for a week, you need to (make AppleWorks) do some additional math. In simplest terms, you need to add 1 to the end time if the end time is on the calendar day after the start time. There's an explanation of this below, which you should read for a better understanding of Time and the Mac, but which isn't necessary to use the formula.
The formula assumes your start time is in column B, your end time in column C, your formula reporting time worked is in column D, and that you will enter times in rows 2..6, and calculate the week's sum in D7
Enter in D2, and fill down to D6: =IF(C2,C2-B2+(C2<B2),"")
Format these cells to display as Time.
Enter in D7: =24(SUM(D2..D6)) —to report the result in hours (eg. 25.678)
Format the cell to display as Number, General.
or
Enter in D7: =INT(24(SUM(D2..D6))&":"MINUTE(SUM(D2..D6)) —to report the result as hours and minutes
Note that the second option for D7 produces a text string which will not be useable in further calculations.
This is Text, so no Number formatting is necessary.
Regards,
Barry
Time and the Mac
The Mac clock tracks time in Days and Fractions of a Day, starting at midnight, January 1, 1904.
Nine PM today, May 8, 2006, represented as a decimal number, is 37383.875. Two AM tomorrow, May 9, 2006, is 37384.0833333333.
An AppleWorks spreadsheet cell (or database field) formatted to display as Time will ignore the whole number part of those numbers, and interpret the decimal fraction part as Time of Day, and display the result in the Time format you have chosen for the cell.
A cell (or field) formatted to display as a Date will ignore the fractional part of the number, and display the whole number part in the Date format you have chosen.
When you enter a time, the result is the time of day on January 1, 1904. When calculating elapsed times where start and end times cross the midnight boundary, you need to add 1 (day) to the result to compensate for the change in day and get a result that can be used in further calculations. That's what the "+(C2<B2)" part of the first formula above does—adds 1 if "(C2<B2)" is TRUE or adds 0 it it's false.
If you add times, the result is 'correct', but if the total reaches 24 hours, the displayed result will appear incorrect as a Time formatted cell ignores the whole number part of the actual result (eg. 27 hours, or 1.25 days), will display as 03:00, the same as 3 hours, or 0.25 days. You can convert the result to hours and fractions of hours by simply multiplying the result by 24, and displaying it as a Number rather than as Time.
B -
How to use elapsed time function with state machine in Lab VIEW
Hello
I've been trying to use state machine with elapsed time function in order to sequentially start and stop my code. The arrangement is to start the code for 1 minute then stop for 5 minutes. I've attached the code, the problem is when I place the elapsed time function out of the while loop it doesn't work, on the other hand when I place it inside the loop it does work but it doesn't give the true signal to move to the next state.
Could you please have a look to my code and help me to solve this issue.
Regards
Rajab
Solved!
Go to Solution.
Attachments:
daq assistance thermocouple(sate machine raj).vi 436 KBRajab84 wrote:
Thanks apok for your help
even with pressing start it keeps running on wait case
could you please explain the code for me, the use of Boolean crossing, increment , and equal functions
Best Regards
Rajab
OK..I modded the example to stop after 2 cycles. Also recommend taking the free online LabVIEW tutorials.
run vi. case statement goes to "initialize", shift registers are initialized to their constants. goto "wait"
"start"= false, stay in current state. If true, transition to "1 min" case
reset elapsed timer with True from shift register(counter starts at zero)."time has elapsed"=false, stay in current state(1 min). If true, goto "5min" case
reset elapsed timer with True from shift register of previous case(counter starts at zero)."time has elapsed"=false, stay in current state(5 min). If true, goto "1min" case. Also, bool crossing is looking for "true-false" from "5 min" compare function to add cycle count.
Once cycle count reaches 2, stop while loop....
Attachments:
Untitled%202[1].vi 42 KB -
How to display elapsed time on TPC-2006 (Pocket PC 2003) as mm:ss?
The small attached PDA vi is a simple "egg timer" that measures elapsed time in minutes and seconds. I've tried every formatting trick I can think of, but cannot get my TPC-2006 to display the elapsed time as mm:ss. It always displays single digit minutes and seconds using one digit instead of 2. By this I mean that an elapsed time of 1 minute and 6 seconds will display as 1:6. My customer expects that elapsed time to display as 01:06.
I tried attaching a %t constant to the "format string" input of the "format into string" sub-vi, but the deployed display showed %t instead of elapsed time.
The second question is, how do I get rid of the up/down icons in the strip display box? They do not show in the virtual front panel, but always show up in the deployed application.
Jeff
Climbing the Labview learning curve!
Sanarus Medical
Pleasanton, CA
Attachments:
MinSecTimer.vi 12 KBHi Jeff,
I solved your first problem. The format string you were looking for to wire into the Format Into String function is %02.0f. Honestly, I can never remember what the syntax is for format strings, but I've devised a method anyone can use to make it really easy. First of all, place a numeric constant on the block diagram. Right click the constant and select Format and Precision. From that dialog, make the changes you like. You can actually see the changes propogate to the constant in real-time if you can see the block diagram constant. In your case, the change you wanted to make was Zero Padding - 2 spaces - pad with zeros on the left. After you've configured your number to look like you want, click on the Advanced Editing Mode radio button at the bottom. This is where you can manually enter in Format Strings for numeric constants or controls. The trick is, whatever changes you currently have made in the default editing mode will show up as a format string that you can copy and paste and use as you like. Hope this helps!
Message Edited by Jarrod S. on 05-25-2006 11:02 AM
Jarrod S.
National Instruments
Attachments:
double_digit_MinSecTimer-2.vi 12 KB
Default_edit.JPG 41 KB
Advanced_edit.JPG 43 KB -
Elapsed Time in Statspack report
There is a java process that made updates to 1 millon rows in the oracle database table. A commit was issued after each update statement in the code. There were 10 java threads(processes) involved in updating the 1 million rows and the total time took 3 hours and 40 minutes. However, in the statspack report pulled for that time period, it indicates that the total elapsed time was 4 hours and 3 minutes. What may be the cause for this difference ?
Thanks to all. I was also reading the same site. ALso what does these mean in case of session details.
memory sorts, table scans, physical reads, logical reads, cursors.
In some of the sessions I have these figures. What can I figure out from this.
(giving the output in vertical way)
ID 105
Status - INACTIVE
Machine- ebank_prd
User Name - EVENT
Elapsed Time- 16,237
CPU Used -645
Memory Sorts-25
Table Scans - 7866
Physical Reads -134
Logical Reads- 115249
Commits 7981
Cursor 104
Buffer Cache Hit Ratio 100
Another one :
26,INACTIVE,ebank_prd,CAIORA, 239,105, 31,093, 9,636, 67,032, 56,334 45,543, 860 0 8 100
Here the epalsed time is 239,105,
cpu used is 31,093
memory sorts is 9,636
table scans is 67,032
physical read 56,334
logical reads 45,543,860
The figures are so high
I performance is slow and what shall I do next to find out whats wrong by looking at the values.
Waiting for your answer.
Thanks again
SL -
How can I display the elapsed time of the course using Advanced Actions in Captivate?
I have a Captivate course which is approximately 35 minutes in length. On each slide I would like to display to the user, the current elapsed time.
EXAMPLE:
25/35 minutes complete
The 35 would remain static, so I have been working with the elapsed time system variable in CP: elapsed:$$cpInfoElapsedTimeMS$$
I can't seem to get the variable to properly display the elapsed time in minutes, rather than miliseconds. Attached is a screen shot of my advanced action.
Can anyone provide guidence regarding how I should structure this differntly?I talked about that Timer widget in that blog post and pointed to another one:
http://blog.lilybiri.com/timer-widget-to-stress-your-learners
If you are on CP7, you'll have this widget also as an interaction, which means it is compatible with HTML5 output. Amd there is also an hourglass interaction, with similar functionality but... did not blog about that one
PS: Check Gallery\Widgets to find all widgets. Default path is set to Interactions -
Problems with TIMESTAMP Field from SQL Server
OBIEE 11g
Hi All,
I want to convert data into OBIEE that is coming from a TIMESTAMP field in SQL Server Database. So in SQL Server field has data like '9/20/2012 12:05:08 AM'. I have first changed the datatype in physical layer to DATETIME and then in BMM I do a CAST(<DATE_FIELD> AS DATE). On the frontend when I use this column the error I get back is [nQSError: 59030] Illegal data type conversion from source type: VARBINARY to target type: TIMESTAMP. (HY000). Does anyone know a workaround or solution.
Thanks in Advance!Hi Guys,
None of the solutions you mentioned have worked unfortunately. I have a date column and another column that holds user id. I basically want to do a count of all the user id's where that particular date column is NULL. I have checked in the physical layer and the date column in question is coming from SQL Server as a TIMESTAMP datatype. So I initially did not change anything and brought the column in as is but that did not work out. I then tried to change the datatype in the physical layer to DATETIME and then also DATE. After changing the datatype in the physical layer in the BMM I would do a CAST(<date column> as DATE) and this still did not work. I then tried to just change the datatype to DATETIME and DATE without doing the CAST in the BMM and this still did not work. Not too sure what to do now.
Maybe you are looking for
-
Failed to open the connection on CR Server 2008 .
Hi, 1. I used trial version of CR Server 2008 V1 SP3, I upload a rtp file into this server and try to view. but after parameters input, I got "Failed to open the connection". this rpt work very will on my CR Server XI version. 2. on this new CR serv
-
Dear forum I need some support. I have upgraded my MacBook Pro 2.2 to Leopard. Defined a Vista 32 Home Premium (original) Bootcamp partition. Everything has worked fine till yesterday. Now there is no way to boot the sistem anymore. If you select Mac
-
ITunes dead after System Restore
I can no longer launch iTunes, and this has nothing to do with spyware. Sequence of Events: 1) Last Thursday, I purchased a new track from itms (Iggy Pop - Candy - it's good, check it out). 2) Upon trying to play the track, I was presented with the m
-
When trying too print vi network to HP office jet pro 8600 get message "printer is idle
Using MacBook Pro and HP Office jet pro 8600mn, printing via wifi it won't print. Get message printer is idle. Pause and resume, no effect. Uninstalled and reinstlled printer no luck.
-
I just bought a Panasonic HDTV (Model TC-P50C2) and I watched a lot of video from internet on my laptop (Toshiba Satellite L305D-S5895). I read somewhere that I can connect my laptop to my HDTV. Then I can watch the internet video on the TV. The T