Skip to Content

Converting 'int' type Unix Time Stamp to date in Crystal Reports (within Visual Studio 2015)

Nov 19, 2017 at 01:20 PM


avatar image
Former Member

I have an int field in my database which is storing the dates in the form of Unix Time Stamps after conversion. I am trying to display this field in my Crystal Reports, by using this formula:

datediff("s", date("1970-01-01 00:00:00"), {order1.OrderDate})

My 'OrderDate' field in the order1 table consists of the integer type of UNIX time stamp fetched from a MySQL database.

I use the Select Expert -- Record section within Visual Studio 2015 as shown above, and see the error (within the formula section).

What would be the best way to convert the int type value into a proper date field and format it as (MM/DD/YYYY) so that it is seen correctly in the final report?

Note - I tried using totext({order1.OrderDate},0) but it errors out saying The result of selection formula must be a boolean.

I'm new to SAP and Crystal Reports, any help would be appreciated! Thanks!

capture.jpg (43.5 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Abhilash Kumar
Nov 20, 2017 at 09:12 AM

Hi Bhavin,

Create a formula with this code:

DateAdd('s', {order1.OrderDate}, Date(1970,01,01))

Drag and drop this formula field on the report where it needs to be displayed.

Right-click the field and Format it the way you wish to.


10 |10000 characters needed characters left characters exceeded