Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Convert Number to Date Post Reply Post New Topic
Author Message
vzirock
Newbie
Newbie


Joined: 28 Sep 2010
Location: United States
Online Status: Offline
Posts: 6
Quote vzirock Replybullet Topic: Convert Number to Date
    Posted: 28 Sep 2010 at 5:49am
I am trying to convert a number field (integer) to a date field so I can sort on the date.  In the original database it is a date entry but when I bring it to crystal for some reason it is a number field (such as 20,100,101 for Jan 1 2010.  I can't figure out the formula to convert this...please help!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Sep 2010 at 6:27am

try:

date(mid(totext({datefield},0,''),5,2)+'/'+ right(totext({datefield},0,''),2) + '/'+ left(totext({datefield},0,''),4))


Edited by DBlank - 28 Sep 2010 at 6:27am
IP IP Logged
vzirock
Newbie
Newbie


Joined: 28 Sep 2010
Location: United States
Online Status: Offline
Posts: 6
Quote vzirock Replybullet Posted: 28 Sep 2010 at 7:11am
which formula spot do I put this in?  the record select formula?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Sep 2010 at 7:23am

in the field explorer as a new formula field

then you can place the formula on the report canvas


Edited by DBlank - 28 Sep 2010 at 7:23am
IP IP Logged
vzirock
Newbie
Newbie


Joined: 28 Sep 2010
Location: United States
Online Status: Offline
Posts: 6
Quote vzirock Replybullet Posted: 28 Sep 2010 at 7:34am
error message that says "the result of selection formula must be a boolean"
 
date(mid(totext({CTCITE.cit_viol_date},0,''),5,2)+'/'+ right(totext({CTCITE.cit_viol_date},0,''),2) + '/' + left(totext({CTCITE.cit_viol_date},0,''),4))
IP IP Logged
vzirock
Newbie
Newbie


Joined: 28 Sep 2010
Location: United States
Online Status: Offline
Posts: 6
Quote vzirock Replybullet Posted: 28 Sep 2010 at 7:36am
oh, ok. that works.  Thanks!Big%20smile
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.