We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Unix Timestamps

What is the most effective way of converting those into usable dates? I have a ton of them.

Eric


9 Replies

VS Vinoth Srinivasan Syncfusion Team June 15, 2017 07:25 AM UTC

Hi Eric 
 
Thanks for your interest in Syncfusion Components. 
 
You can convert the Unix TimeStamps values as Date values using the following expression in our report designer. 
 
=DateAdd("s",Fields!TimeStamp.Value,"1970-01-01 00:00:00") 
 
We have prepared a sample report based on this and it can be downloaded from the following location. 
 
Also, please refer the below MSDN forum for more details. 
 
Regards, 
Vinoth S. 



EK Eric Kok June 16, 2017 08:56 PM UTC

Vinoth, 

My posting was not complete, I guess. I am using the Dashboard Designer. I don't seem to have the option to use the DateAdd formula anywhere. Am I overlooking something?

Eric 


US Umapathy Shanmugam Syncfusion Team June 19, 2017 08:58 AM UTC

Hi Eric, 
 
Thanks for your reply.  
 
Could you please let us know the following details, so that we can understand your query better and provide a solution. 
  1. Connection type which you are using.
  2. Are you expecting to convert the string column which is in date format to date time column.
  3. Provide some details about your requirement.
 
If you need to convert your string column to date time column in your dropped table we have “Change column type” option in column settings. Please refer to the below link to know more about handling column type conversion in our dashboard application.  
 
Regards, 
Umapathy S. 



EK Eric Kok June 19, 2017 09:51 AM UTC

  1. Connection type is ODBC.
  2. Are you expecting to convert the string column which is in date format to date time column. The content is a UNIX timestamp, so the system sees it as a number and I would like to convert it somehow to a date. E.g.: Timestamp: 1497855166
  3. I would like to use those timestamps as date in the Dashboards. 


US Umapathy Shanmugam Syncfusion Team June 20, 2017 07:34 AM UTC

Hi Eric, 
 
Thank you for sharing the requested details.  
 
We assumed that you are using MySQL as ODBC server type and follow the below steps to convert UNIX timestamp as date through expression designer window.  
 
Create expression like below to convert UNIX timestamp to date.  
 
S.No 
Expression Name 
Expression 
Comments 
Expression1 
FROM_UNIXTIME('1497855166') 
Convert 1497855166 this time stamp value as date 
Expression2 
FROM_UNIXTIME([UnixTimeStampColumn]) 
Convert UnixTimeStampColumn value as date 
 
Now both Expression1 and Expression2 will act as date field and we can use it in widgets. Please refer the below link to know more about expression creation.  
 
Please do let us know if you required any other assistance.  
Regards, 
Umapathy S. 



AD Alexey Dovgan May 11, 2018 07:56 AM UTC

This is does not work with REST Web Data Source.



AR Anandaraj Radhakrishnan Syncfusion Team May 14, 2018 10:52 AM UTC

Hi Alexey, 
 
Mentioned conversion process in our previous reply of this forum was particularly suggested for ODBC MySQL data source and it won’t work for web data source. So, we are suggesting you to use the below provided expression for web data source.  
 
Create expression like below to convert UNIX timestamp to date.    
 
S.No  
Expression Name  
Expression  
Comments  
1 
Expression1  
datetime('1497855166','unixepoch', 'localtime') 
Convert 1497855166 this time stamp value as date  
2 
Expression2  
datetime([UnixTimeStampColumn],'unixepoch', 'localtime') 
Convert UnixTimeStampColumn value as date  
  
Now both Expression1 and Expression2 will act as date field and then we can use it in widgets. Please refer the below link to know more about expression creation.   
  
Please do let us know if you require any further assistance.   
 
Regards,
Anandaraj R
 



MV Malcolm van Staden September 25, 2019 10:54 AM UTC

Hi,

We have tried to make use of datetime('1497855166','unixepoch', 'localtime') in order to convert our timestamp values to datetime values. But the expression column isn't being seen as a datetime but rather as string. How can we go about resolving this?


DG Dhivyabharathi Govindaraj Syncfusion Team September 25, 2019 12:14 PM UTC

Hi Eric, 
 
In our Designer, while connecting Files type and Web data source connections we have processed those data’s in in-memory and moved those data internally into SQLite server for dashboard functionalities. Later we have queried the SQLite server for all dashboard interactions. Please refer below documentation, https://help.syncfusion.com/dashboard-platform/dashboard-designer/connecting-to-data/classification-of-data-sources-queried-directly-and-in-memory  
 
SQLite Database doesn’t support Date data type. So even though you are using datetime function in your expression, it will return the result in string type.  
 
We suggest you to your expression in String type itself in your dashboard since SQLite database won’t support Date time data type.  
 
Kindly let us know if you need any further assistance. 
 
Thanks, 
Dhivya 


Loader.
Live Chat Icon For mobile
Up arrow icon