coverting time

Six Stars

coverting time

Hi All,

 

Am using tstatscatcher component, it has a column duration i want to calculate the end time from duration column how can i do it?

 

I searched in forum and tried with new java.util.Date(ColumnName) , but its not giving the correct date 

 

for example if i have 4000 as input its giving output as "05:30:04.000" -- its adding IST how can i handle it.

 

 

Thanks in advance,

Lmit

Nine Stars

Re: coverting time

Hi Lmit,

 

What is the expected output for 4000.

i am assuming expected output should be 4000 = 01:06:40, please conform.

 

Regards,

 

 

Veeru Boppudi
Six Stars

Re: coverting time

Thanks for your reply Veeranjaneyulu,

 

Yes your assumption is correct

 

to be more clear , i want to add moment and duration which will come from tstatscatcher component so that i can generate end time of a job.please find the attachment for the columns.my end time should be data and timestamp

 

Thanks,

lmit

 

Seven Stars skh
Seven Stars

Re: coverting time

Hi,

If you have some knowledge on Java , you can try tJava Component and try to convert the seconds into the HH:mm:ss format. For your reference am providing you a sample code which will convert the seconds into HH:MM:ss  time format.

 

        int seconds = 4000;
        int p1 = seconds % 60;
        int p2 = seconds / 60;
        int p3 = p2 % 60;
try{
        System.out.print("Input seconds:");
        p2 = p2 / 60;
        System.out.print( p2 + ":" + p3 + ":" + p1);
    }    
finally
{
}

 

Thanks,

Hameed

 

 

Nine Stars

Re: coverting time

Hi Lmit,

 

If you want to derive start and end time of job, you need derive it based two records from tstatscatcher. 

 

+-------------------+-------------------------+
| key | value |
+-------------------+-------------------------+
| moment | 2018-03-15 09:12:55 |
| pid | c8EvWV |
| father_pid | c8EvWV |
| root_pid | c8EvWV |
| system_pid | 14512 |
| project | PRICTICE |
| job | job_CMS_PROCESS |
| job_repository_id | _O6fewAbYEei8pvE2fGbI1g |
| job_version | 0.1 |
| context | Default |
| origin | null |
| message_type | begin |
| message | null |
| duration | null |
+-------------------+-------------------------+


+-------------------+-------------------------+
| key | value |
+-------------------+-------------------------+
| moment | 2018-03-15 09:13:11 |
| pid | c8EvWV |
| father_pid | c8EvWV |
| root_pid | c8EvWV |
| system_pid | 14512 |
| project | PRICTICE |
| job | job_CMS_PROCESS |
| job_repository_id | _O6fewAbYEei8pvE2fGbI1g |
| job_version | 0.1 |
| context | Default |
| origin | null |
| message_type | end |
| message | success |
| duration | 16087 |
+-------------------+-------------------------+

 

If message_type begin means job start and message_type='end' means job end time.

The duration is not in seconds, its in milliseconds. If you want to caluclate start and end time using one record, you need to use message_type='end' record and substract duration from moment, so you will get start time of that process.

 

Regards,

 

 

Veeru Boppudi
Six Stars

Re: coverting time

Thanks for your replies,

 

when i was clearing observing the tstatcatcher records i noticed that the begin and end records have different timestamp, the time(moment column) in the end record can be consider as end time?

 

If you see in the attachment , for both records of same flow has a timestamp difference of one sec. so can i consider it as a end time of the job?

 

Thanks,

lmit

 

Seven Stars skh
Seven Stars

Re: coverting time

Yes lmit, you can consider this as the Job Execution duration as 1 Sec(Time taken to finish the Job).

 

Thanks,

skh

 

 

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.