Time Stamp Calculation
Hi,
I am using Oracle Database version 11.2.1 and would like to calculate the time difference in minutes between start_date, start_time and end_date, end_time. The date is stored in a seperate column to the time. Also the time is stored as a number.
Please see the test scripts below:
create table test
(start_date date,
start_time number,
end_date date,
end_time number)
insert into test values('20-JAN-2012', 103413, '01-FEB-2012', 110917);
insert into test values('01-MAR-2012', 091734, '01-MAR-2012', 103555);
insert into test values('19-APR-2012', 103413, '20-APR-2012', 125012);
insert into test values('13-JUL-2012', 123432, '13-JUL-2012', 123450);
insert into test values('01-MAY-2013', 164522, '06-MAY-2013', 110917);
insert into test values('10-MAY-2013', 085011, '13-MAY-2013', 135635);
Please note that the following exceptions need to be taken into account in the calculation
1. Exclude weekends (Sat & Sun)
2. Only calculate working hours from 08:45am to 17:15pm
Can anyone help?
Thanks
sliderrules wrote:
Hi,
The fields are stored this way in the system and are extracted as two seperate columns. Can the data and time be combined into one date field?Hi,
I agree with John that this is a really bad design. You actually don't need start_time and end_time as you can have all the information start_date and end_date.
i.e.:
update test
set start_date = TO_DATE(TO_CHAR(start_date,'YYYYMMDD')||TO_CHAR(start_time,'fm000000'), 'YYYYMMDDHH24MISS')
, end_date = TO_DATE(TO_CHAR(end_date ,'YYYYMMDD')||TO_CHAR(end_time ,'fm000000'), 'YYYYMMDDHH24MISS');
select start_date, end_date
from test;
START_DATE END_DATE
20/01/2012 10:34:13 01/02/2012 11:09:17
01/03/2012 09:17:34 01/03/2012 10:35:55
19/04/2012 10:34:13 20/04/2012 12:50:12
13/07/2012 12:34:32 13/07/2012 12:34:50
01/05/2013 16:45:22 06/05/2013 11:09:17
10/05/2013 08:50:11 13/05/2013 13:56:35 And for calculate your working hours you can have a look at this: {message:id=10655484}
Regards.
Al
Edited by: Alberto Faenza on May 21, 2013 2:11 PM
Added link for hours calculation
Similar Messages
-
Can access a files time stamp for calculations?
I'm using Diadem 10.2. We have an issue with our data, where the first cycle is corrupt iff the time stamp between the current file and previous file is less than 30 minutes. This indicates a manual intervention, and it results in skewed results.
I want to discard the first cycle when the File time stamps are less than 30 minutes apart...but I can't find a way do it.
We use runtime in the file as a time channel, begins at zero each file, so i can't use any channel values to do this?
Thanks in advance for the help. Completing this task will end my assignment with this team, and I'll be moving to a new position at the end of the week. Not sure if Diadem is in my future or not, but I highly doubt it.
Thanks in advance...Hi Jeff,
What type of data files are these? If it's a custom file format, did you write the DataPlugin that reads the file into DIAdem? Is the aquired date/time stored inside the data file somewhere? For a TDM or TDMS file, this would typically be in the "File.DateTime" property, which shows up in the DataFinder as "File.Storage datetime" and in the Data Portal as "File.Storage date/time".
The File created and modifed dates you get from Windows tend to change unexpectedly, so it would not be ideal to use those for a mission-critical process.
I'm assuming that you're loading all the various data files into DIAdem, then concatenating them into contiguous channels that contain all the data from all the files. You will then need to use e "Calculate Differences" ANALYSIS function to create a new channel that has the delta date/time values for each row. Once this is the case, you can use the Channel Calculator to find rows where the delta date/time value is invalid and set these rows equal to NoValues.
Brad Turpin
DIAdem Product Support Engineer
National Instruments -
Time Stamp not affected by change of calculated fields.
Dear Experts,
We have several calculated fields that are depended on values of lookup records or the system-time.
I experienced during recalculation that when the calculated field changes the Time Stamp did NOT change. This change did also NOT trigger the workflow with Trigger Action: Record Update. AND the record is not Syndicated because the syndication map has Suppress Unchanged Records.
Has anyone an idea how to solve this?
Kind regards,
Job JansenDear Kanstantsin,
I don't know what you mean by "simple field" but I have 2 calculated fields one is Text and the other is Boolean. In both cases the Time Stamp is not updated during recalculation.
Of course both fields are selected fields in the Time Stamp field.
Kind Regards,
Job Jansen -
FROM AI START VI TO FORMAT AND APPEND VI TO CONCATENATE STRINGS,SECOND INPUT IS TAB,THEN EVEY OTHER ONE IS TAB. THIRD AND FIFTH INPUT IS ATTACHED TO GET DATE/ TIME VI, THEN END OF LINE, THEN CHANNEL 0; TAB; CHANNEL 1;TAB, AND SO ON THROUGH CHANNEL 7. THEN THE LAST INPUT IS END OF LINE. ON THE SPREADSHEET I RECIEVE THE SCAN RATE, THEN THE DATE ,THEN THE TIME; ALL ON THE FIRST ROW. THE NEXT ROW HAS THE COLUMN LABLES, AND DATA GOES TO THE CORRECT COLUMN. BUT NO TIME STAMP COLUMN. I WOULD LIKE IT TO BE IN COLUMN "A" EVEN WITH THE FIRST ROW OF DATA. EX." 10:01:01 200 300 400
10:01:03 200 300 400
THANK YOU
FOR YOUR HELP, JOE BOB CRAINI think the best way is to generate an array of time values to send to your spreadsheet BEFORE channel 0 data.
To generate the array you can use Ramp Pattern.vi from 0 to 'Actual Scan Rate' (from AI Start) * number of scans performed.
That way in your spreadsheet you will have the first line same as now, next the columns with time(secs), channel 0, channel 1... channel 7.
If you need the time column with date and time string, you can use Get Date/Time in Seconds.vi when you begin acquisition, then sum the seconds obtained to the array calculated as above and next use Format Date/Time String.vi to obtain the time stamp you need, next build array of time stamps and sent to your spreadsheet.
Hope this helps
Roberto
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
Write the time stamp to a excel file
Dear all superusers,
The title imply my question that is how to store every time stamp obtained to an excel file. But when open the file, it contains nothing. Could someone help on this matter.
Regards,
Lee Joon Teow
Electronic Test EngineerHi LJ,
here's an example for writing timestamp to Excel-compatible csv file...
The details of the calculation are given here!
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome
Attachments:
TimestampToCSV_LV80.vi 11 KB -
Time Stamp a Voice Memo to the Second
I need to make a voice memo that's date and time-stamped to the second. It looks like Voice Memo doesn't do this (but if there's a way to, please advise!). Does anyone know an app that would do this? The greatest thing would be to be able to make the file name related to the date/time again to the second.
Thanks for any advice. This is to replace a system on an old Palm Pilot using Audacity Audio with the date/time stamp option for naming capable to the second as well....I have the same problem. I noticed it for the first time after the recent IOS 7 update. The audio file I recorded using "Voice Memos" was trimmed down to 2 seconds, but iTunes reads it at full length (1:13) so I can't add it as an alert to my phone. Oddly enough, the playback only lasts 2 seconds in iTunes, so it seems like there is an issue with how iTunes is calculating the time for trimmed Voice Memo files.
-
Time Stamp via Custom Function
This is such a basic concept for a custom function that I am assuming someone out there has done it already. I have never created a custom function for Essbase, though I have programmed in a variety of languages and I'm assuming getting the current date/time in Java is not exactly rocket science. I have reviewed the docs for creating and registering custom functions and that also appears relatively simple, especially with the examples available.<BR><BR>What I want is a function that returns a Double in the form of a Date/Time that I can retrieve into Excel and display as a Date/Time. We want a simpler, more effective way of time stamping the running of calculations, more effective than combing through the app logs when we need to know if/when a calc ran a week or a month or two ago.<BR><BR>Does anyone have some sample code and/or insights to share on this topic? I would greatly appreciate it if you do.<BR><BR>Thanks,<BR><BR>James
fyi - I ended up implementing a solution in Perl/Maxl that gives a timestamp to the second in a format that can be retrieved intelligently into Excel. I use the Perl time() function (Unix server) to get the GMT epoch time as a long int. Then I convert it into the floating point DATE format for Windows, with the hard-coded assumption of what time zone my server is in. Then I run a calc from MaxL that sets this value. I build the calc string in Perl and pass it into MaxL. Pretty cool. The calc uses two sub vars, one for the members to fix on and the other for the Scenario to timestamp. This way the perl/maxl is database independent.<BR><BR>Just thought someone might want to know...
-
Skipped seconds in time stamp loop
Hi all,
I have a two 6024E cards which I am synchronizing via a RTSI cable. I
have an 860mHz Dell dimension with 512 MB of RAM. I am simply logging
analog signals from the cards to a text file on a 1s timebases. The
problem is that the output data file shows a time stamp is missed every
once and a while. I have tried adjusting the rate of sampling and
number of samples, but there always appears to be a hiccup in the
timestamping. I even tried hardware timing with a timed loop and one of
the on-board counters. The hiccups were even more frequent then. Maybe
the code needs to be more efficient, but I am stumped. I attached the
data logger vi. I appreciate any input.
Thanks,
dewey
Attachments:
acquire_ver5a.zip 1433 KBHello Dewey,
A couple recommendations for your program:
You are manually generating a timestamp for your signals using an
elaborate algorithm that I haven't really taken the time to
understand. I might be easier, more efficient, and more accurate
to just acquire your data as a Waveform data type from the DAQmx Read
Analog VI instead of acquiring data as an array of doubles. The
Waveform data type includes a built in timestamp that you could parse
out and log to file instead of calculating your own timestamp using the
Tick Count (ms) VI. Take a look at the LabVIEW Help and there is
a section under File I/O about Writing Waveform Data to a File Using
Storage VIs.
I would also highly recommend you remove any Wait or Wait for Next ms
Mutlitple VIs from your program. You are already configuring the
sampling rate of your continuous acquisition earlier in your program
using the DAQmx Timing (Sample Clock) VI. This is configuring the
DAQ tasks to use the hardware clock to use the onboard sample clock of
Dev1 for your acquisition. With the sample clock timing
configured, the NI-DAQmx driver will automatically take care of the
speed of execution of your while loop based on the rate you specify in
the DAQmx Timing VI. By manually including waits in your while
loop, you are conflicting with the timing parameters you set up in your
DAQ task. This could lead to buffer overflows, missed samples,
and otherwise non-deterministic sample timing. I would suggest
taking a look at the LabVIEW DAQmx shipping example Multi-Device
Synch-Analog Input-Continuous Acquisition.VI which can be found in the
NI Example Finder (Help >> Find Examples) in the following
category: Hardware Input and Output >> DAQmx >>
Synchronization >> Multi-Device.
I hope these suggestions help!
Regards,
Travis G.
Applications Engineering
National Instruments
www.ni.com/support -
Number to time stamp function: criptic help
Your help is VERY misleading.... it costed me hours...
If you say that the time stamp is "time-zone-independent number of seconds that have elapsed since 12:00 a.m., Friday, January 1, 1904, Universal Time" you should display it as it is or *please* say that the time stamp is calculated in UTC time but displayed in local time.
In fact, if I want to convert 3600, I would expect to see 1:00 am 1/1/1904, but I see 6:00 pm 12/31/1903, because I am in Colorado....
By the way... it is wrong anyway, because there is now Daylight Savings time, which puts CO at UTC-6, not UTC-7..... Why don't you just have it display UTC time and we can all figure out where we live??Did I say something like that?
And in LabVIEW 8.6 the Date/Time Format functions have an option to select if you want to see local time or UTC. And believe me if LabVIEW would display by default UTC instead of local time, 99.999% of the users would complain in a way that NI would not be able to do other business than answering those complaints anymore.
About the time zone difference you should probably check your Windows settings. LabVIEW is simply using whatever Windows believes is the timezone it is working in. You usually select that during installation of a Windows system and there are various options such as not letting Windows adjust for DST automatically and then you might have adjusted simply the timezone or something.
Rolf Kalbermatter
Message Edited by rolfk on 08-18-2009 09:32 PM
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
Hello team,
Actually i was taking Back up time stamp of ABAP system using DB12 and from OS level , i found that from DBserver time is 21:18 GMt and from SAp gui it is 20:00 gmt , may i know why there is the difference in time stamp but my sap is completely in synchronise with DATABASE server.
Can anyone let me know shall i go for sapnote ?Hi,
On the SAP side, run transaction /nSTZAC. The system time zone is client independent and uses default time zone (client dependent).
The OS time and SAP system time should be the same.
The tables for time zone customizing are client dependent and therefore it is necessary to change the time zone settings in each client to receive a correct date/time calculation. It is necessary to update the DST rules in all clients including 000.
In terms of Java please check.
834520 Mapping of time zones between UME and ABAP
You can change the timezone of the JVMs using the -Duser.timezone parameter
So you should add -Duser.timezone=<timezone> to all dispatcher and server processes in your systems, using the configtool
1) open config tool
2) select yes
3) select "cluster-data->instanceXXX->serverXXX/Dispatcher"
4) in "Java parameters" add new line "-Duser.timezone=<timezone>"
5) click "Apply changes"
6) restart your instance
Please refer to following link which gives you the list of
user.timezone supported by JVM 1.4
Supported user.timezone property values for the Development Kit for Java
http://publib.boulder.ibm.com/infocenter/wsdoc400/v6r0/index.jsp
?topic=/com.ibm.websphere.iseries.doc/info/ae/ae/adrtzval.htm
This should resolve your issue..
Best Regards,
Hemanth -
What exactly IS Time Stamping?
Hi,
I'm building a web application in an effort to create
something not only practical to use, but to also improve my
programming abilities.
At the moment, I store records in a database with separate
columns for Time and Date.
What I want to know is, is this a good way about doing
things? I have tried to research the best way to store dates and
times but can't find much on the subject for a beginner like me.
I have often seen the format:
{ts '2008-04-10 20:13:00'}
...floating around on the web - is this the proper way to
maintain a time stamp?
I simply want to do things properly from the ground up so
would appreciate your advice and guidence on how to handle the
storage of dates and times. If you could spare a minute to explain
the best practice and pitfalls of this it would be much
appreciated.
Apologies if I sound really stupid!
Thanks,
Mikey.Kapitaine wrote:
> Hi, thanks for the reply.
>
> So would it actually sit in my DB column as:
>
> {ts '2008-04-10 20:13:00'}
>
> Then do CF functions like this? e.g:
>
> <cfset variables.test = "{ts '2008-04-10 20:13:00'}"
/>
> <h2>#dateFormat(variables.test,
"dd/mm/yyyy")#</h2>
> <h2>#timeFormat(variables.test, "hh:mm:ss
tt")#</h2>
>
> Seems to work, but is this correct? Should the date and
time be stored toether
> like that? Why does it need curly braces and a "t". Is
this some kind of
> convention?
>
> Thanks,
> Mikey.
>
Well, no, that is a string that ColdFusion typeless automatic
conversion
is allowing to work for you. You exact example would probably
be better
down as:
<cfset variables.test =
createDateTime(2008,4,10,20,13,00)>
Now you have an actual date-time object variable that is
easily
accessible for all date-time functions, calculations and
formating. -
Hi
I have managed to generate time stamped excel file which works fine only for only single logging. If I have to do multilpe loggings, then my program does not create a new file. So can anybody have a look at my file and help me out why is it not creating new file everytime when Logging button is pressed
Thanks
Solved!
Go to Solution.
Attachments:
time_stamped.vi 19 KBHi,
I am working on a project which involves logging of different calculated real time values to excel file and then insert graph in same previous saved file.
So at the moment, I am able to generate time stamped file (e.g test_28_04_10_10_2). I have to implement further improvements to this excel file.
1)Column headings should be bold.
2)Insert graph in same saved file.
I did tried report generation toolkit but found that I need to use function "New Report" function because return type of this function is report out which is being used as an input in every report generation function.
The drawback of using this New Report function is that, it opens up Excel in real time and then user has to save the file by itself. I can work with this function if excel doesnt opens up and generate graph in the background.
Thanks -
Hi all,
i am working on a scenario...
it is file based..no mapping and bpm can be used.
I need to pick up file through xi and append it and put in the target with time stamp to it.
we can achieve this if mapping or bpm is allowed.....
But,in file processing we can use only one option at a time.....
I found a way:
scenario one: files will be appened and kept in a temparory folder
using another scenario we will pick up the appeneded file and add time stamp and keep in target structure...
but i dont think this is advisable...
please suggest me any other ways to achieve this...(can run operating system command be helpfull??)
thanks in advance..
Regards,
Kiran.HI,
Yes you are right, Appending and adding Time Stamp will not be possible simultaneously.
Refer - this could help you
Dynamic Filename with TimeStamp
Dynamic Filename with TimeStamp
/people/william.li/blog/2006/04/18/dynamic-configuration-of-some-communication-channel-parameters-using-message-mapping
But some how you have to use mapping for it. Then if its allowed to use the mapping then as you have suggested, should have to go for two scenarios. No alternative,
Probably also you can try with Customized Adapter Module for this.
Thanks
swarup -
Changing time stamp format in the file receiver adapter file name
Hi all,
How can we change the standard date time stamp from
filename_yyyymmdd-hhmmss-mil
to
filename_yymmdd_hhmmss
i.e., I want "underscores" instead of "hyphens" and also I do not want the MilliSeconds.
I read in the forums that I have to use the combination of variable substitution and mapping functions to do this, but not sure how exactly.
Can the experts help me with this please?
Many thanks.Hello Ramesh,
You can make this possible using runtime filename creation using UDF.
Please go though the below steps.
Message mapping:
Create an UDF and include the piece of code that captures the Filename and Timestamp from source side via ASMA.
Modify them according to our requirement by adding the <Timestamp> at the end of <filename> with _.
Map the UDF to any of the top level node so that the modified filename will be available for the target communication channel
UDF Code is:
try {
String filename = "";
String timestamp = "";
DynamicConfiguration conf1 = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create( "http:/"+"/sap.com/xi/XI/System/File","FileName");
DynamicConfigurationKey key2 = DynamicConfigurationKey.create( "http:/"+"/sap.com/xi/XI/System/File","SourceFileTimestamp");
filename = conf1.get(key1);
timestamp = conf1.get(key2);
filename = filenametimestamp".xml";
filename = filename.replaceAll( "-" ,"_" );
conf1.put(key1,filename);
return filename;
catch(Exception e)
String exception = e.toString();
return exception;
Click on Advanced tab and check the Option u201CSetAdapterSpecificMessageAttributesu201D in addition to that check the attribute that are required to be captured during run time. In our case File Name and Source File Time Stamp are required to be checked
In the receiver communication channel Mention u2018 * u2018as File Name Scheme.
Click on Advanced tab and check the Option u201CSetAdapterSpecificMessageAttributesu201D in addition to that check the attribute u201CFile Nameu201D which will carry the modified value in the UDF .
i hope this will help you.
Monica -
VOICE MEMOS and Wrong Time Stamps in Itunes
I've noticed that my voice memos in the new iTunes 11.1.3 (8) have incorrect time stamps all over them now. This is a real problem for me, since I need the dates that the messages were recorded. I just tested this out by recording a new one today (2/11/14) on my new Iphone 5s. It showed up dated 8/13/12 2:13pm. My phone has the correct date on it, so what gives?
Any solutions out there?
Not to mention the fact that there are NUMEROUS DUPLICATES of previous memos that have become weird artifacts in my iTunes library each time I've backed up my materials. AND the new iTunes setup makes it incredibly hard to *actually remove data* from my system. I am concerned my private material is no longer private, but being archived elsewhere for meta-data purposes.
C'mon, Apple. You're really slipping.I see all timezones, have you tried setting the time/date manually? I'd do than, then pop an email to support.
Norwegian and a BB/PB user. Read what I mean, not what I spell.
Maybe you are looking for
-
No Internet acces or only one computer at the time
Hi everybody, I'm a freelance IT supported and I'm new to Apple. I studied and always worked with PC but with people having more and more Mac at home I had to adapte. I have a problem at a customer's place which is kinda hard to explain. I'm unable t
-
My MacBook Air is boiling within 3 minutes of run
Hi, I bought my MacBook Air around end of 2010. And recently I started experiencing overheating within 10 minutes of run by using common softwares and web browsing. Actually sometimes I've Chrome or Firefox with over 200 tabs (with flash blocker) or
-
Select query 'for all entries'
Hello Friends, SELECT emp_id emp_name INTO corresponding fields of table itab_emp FROM employee for all entries in itab_dept WHERE emp_id = itab_dept_emp_id. In the above select query we are using 'for all entries'
-
Error in accessing SQL Developer
Hi, I am using Windows Xp-32 bit system and I have installed SQL developer 3.2.20.09.87.I have installed both jdk 1.6 and jdk 1.7 but when i am opening it this error is coming:- Unable to create an instance of the java virtual machine Located at Path
-
Unknown e-mail addresses appearing as options
When choosing an e-mail to send to, there are various e-mails that appear as options that I don't recognise. They are not in my contacts, and aren't addresses I've previously mailed. I would like to delete them, so they do not appear as options in f