Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Difference/substract Timestamp

  1. #1
    Join Date
    Nov 2015
    Posts
    15

    Default Difference/substract Timestamp

    Hi all,

    I'm currently getting the result of the difference of two timestamps. The problem is with the result timestamp. Here is an example being res1=(A-B) from http://wiki.pentaho.com/display/EAI/Calculator:

    date1 date2 res1
    2016/12/12 13:41:17.324116000 2016/12/12 13:41:17.432933000 1970/01/01 01:00:00.000000108
    2016/12/12 13:41:17.450360000 2016/12/12 13:41:17.468388000 1970/01/01 01:00:00.000000018
    2016/12/12 13:41:21.634654000 2016/12/12 13:41:17.468388000 1970/01/01 01:00:00.000000645

    The result shouldn't be 1970/01/01 01:00:00.108817000 for the file numer 1?

    Thanx so much.

  2. #2
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    Actually, the difference between 2 Timestamp values isn't a TimeStamp, but a certain amount of nanoseconds.
    You shouldn't interpret that amount as a localized Timestamp.
    So long, and thanks for all the fish.

  3. #3
    Join Date
    Nov 2015
    Posts
    15

    Default

    Hi! thx for the answer

    I'm doing something like this in a step named like "javascript modified":

    var diff_hours = dateDiff(timestampInicio, timestampFin,"hh");
    var diff_minutes = dateDiff(timestampInicio,timestampFin,"mi");
    var diff_seconds = dateDiff(timestampInicio,timestampFin,"ss");

    var hourstomin = diff_hours*60;
    var secondstomin = diff_seconds/60;

    var ResultMin = hourstomin + secondstomin + diff_minutes;

    //Alert(diff_hours);
    //Alert(diff_minutes);
    //Alert(diff_seconds);
    Alert(ResultMin);

    Anyways, do pentaho have any kind of step to convert the nanoseconds between the difference with 2 timestamps?

  4. #4
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    Quote Originally Posted by Alsrroum View Post
    do pentaho have any kind of step to convert the nanoseconds
    Convert to what?
    So long, and thanks for all the fish.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.