Hi,
In my Table Transformer, I would like to calculate the number of days since Created.
The following select statement produces what you see in the attached.
SELECT FORMATDATE(NOW()), FORMATDATE(T1.'Created') FROM T*
However, the below produces nothing. What am I missing?
SELECT FORMATDATE(NOW()) - FORMATDATE(T1.'Created') FROM T*
Thank you.
UPDATE: From one of the online post, I was able to find the answer.
(CAST(ROUND(ceiling(DATEDIFF(DAY,T1.'Created',NOW())))as int))
Hi @Leona Vo ,
You may also try the following SQL query:
SELECT *,
DATEDIFF(day,T1.'Date',"today")
AS 'Date Diff'
FROM T*
The date format for this example in the Table Transformer macro settings (Settings tab -> Date format) should be set as "m/d/y".
Hope this also helps.
Hi @Katerina Kovriga _Stiltsoft_ thank you for your reply. Your solution is much easier to read and understand. It works beautifully. I add ROUND() to the function to produce integer.
SELECT T1.'Created', ROUND(DATEDIFF(day, T1.'Created', "today")) as 'Ticket Age' FROM T*
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks for your post. I also had a similar issue previously but right now i have got the ticket age from your query but next is that i also need that out of the total days say 100 there will be Saturday and Sunday as well , how to reflect correct number of days in Integer excluding Weekends. Any help here will be much appreciated!!
Thanks
Arijit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.