Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Convert integer to datetime Post Reply Post New Topic
Author Message
scotjer
Newbie
Newbie


Joined: 24 Apr 2009
Online Status: Offline
Posts: 2
Quote scotjer Replybullet Topic: Convert integer to datetime
    Posted: 24 Apr 2009 at 1:57am
Hi guys,

I wonder if somebody can help me.
I have a "modified date time" field in a database, the value is 609066016. I've been unable to convert that into a datetime, although the fieldname suggests it is one.
I believe the number means 20/04/09 13:57:01.
Any idea how to convert the integer to datetime with a formula in CR2008?

Thanks in advance!
scotjer
IP IP Logged
scotjer
Newbie
Newbie


Joined: 24 Apr 2009
Online Status: Offline
Posts: 2
Quote scotjer Replybullet Posted: 24 Apr 2009 at 8:31am
ok, found a solution. If anybody is looking for a similiar solution:

CDate (({PROBLEMS.MODIFY_DATETIME}/(24*60*60))+2 +(Date (1990, 1, 1)-Date (1900, 1, 1)))

Im my case the base date was 01/01/1990 and I had to add the +2 to correct the date.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Apr 2009 at 8:42am
Is this unix time?
if so:
 
your sample item of 609066016 would end up as:
4/20/1989   9:00:16AM
If not, you would need to figure out what the start point is for the time and make sure this is total # of seconds then adjust the formula part of "datetime(1970,1,1,0,0,0))" for the true start time.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.