Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
How to convert the System timestamp to Epoch Unix timestamp in talend. Is there any function like java.util.Date.gettime() to convert it into milliseconds.
Meaning converting yyyy-MM-dd HH:mm:ss to unix epoch timestamp.
Example
2020/01/30 00:00:00 to Unix timestamp. Then i want to subtract the unix timestamp by 1 so that it can give me 1 sec less.
Can anyone help me in this ??
Thanks,
Abhishek
But first i need to convert system timestamp into unix timestamp.
As far as I understand you question, you just have to do this:
TalendDate.addDate(TalendDate.getCurrentDate(), -1, "ss")
It will give you the current date minus 1 second.
Just store the result to a field with datatype Date or a global variable you have to cast to Date when you want to use the content.
Hi,
Say suppose today is 2020/1/29 00:00:00. By using
TalendDate.addDate(TalendDate.getCurrentDate(), -1, "ss")
i get the time 2020/1/28 11:59:59 pm. Then i convert this time to Epoch timestamp i.e into 1580255999.
Thanks,
Abhishek
To convert current date - 1 second in epoch:
TalendDate.addDate(TalendDate.getCurrentDate(), -1, "ss").getTime()
As my server is in PST time zone
getCurrentDate()
gives me that zone time, can i convert this into UTC time before converting into unix time.
What i should give in schema to get epochunixstamp