Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I need the age of a TIMESTAMP, not only the year, but also including months, days and hour. How can I do that.
I need it in this specific format:
And this is the script I've got so far:
TABLE:
LOAD * Inline [
ID, Name, Birthdate
1, John, 04/03/1998
2, Luke, 07/07/2003
3, Sarah, 30/03/1996
];
AGE:
NOCONCATENATE
LOAD
ID,
Name,
Birthdate,
Age(Now(), Birthdate) as Age
RESIDENT TABLE;
Drop table TABLE;
And this is the table result so far:
first off you need to make sure you are using timestamp consistently. for example:
next you need to use now() which is a time stamp. this was run at about 8:01AM: the diff between now() and your date will be a number in HOURS so it will just be a matter of getting the whole number and the fraction is converted into minutes and if you want more granularity, get the next set of fraction to convert it into secs. etc..
below i am displaying hours