
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to convert the System timestamp to Epoch Unix timestamp
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You just have to use it with a negative value.
https://help.talend.com/reader/~R4Lk_SlELw9a8pKBKTm9A/97HhybirKNimDaj6MWfaDg

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
But first i need to convert system timestamp into unix timestamp.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate 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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To convert current date - 1 second in epoch:
TalendDate.addDate(TalendDate.getCurrentDate(), -1, "ss").getTime()

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What i should give in schema to get epochunixstamp
