Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Convert string to date Post Reply Post New Topic
Author Message
docmig
Newbie
Newbie
Avatar

Joined: 18 Mar 2012
Location: United States
Online Status: Offline
Posts: 3
Quote docmig Replybullet Topic: Convert string to date
     Posted: 18 Mar 2012 at 5:45pm
I have a string in the format mm/dd/yy that I need to convert to a date in CR. The years are all 2000 or greater.  How do I do this?
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 19 Mar 2012 at 3:13am
date("20" & right({table.field},2),left({table.field},2),mid({table.field},4,2))
 
Regards,
Ryan.


Edited by rkrowland - 19 Mar 2012 at 3:14am
IP IP Logged
docmig
Newbie
Newbie
Avatar

Joined: 18 Mar 2012
Location: United States
Online Status: Offline
Posts: 3
Quote docmig Replybullet Posted: 20 Mar 2012 at 6:05am
Thanks but when putting in the formula I get the  following error when checking it:
 
Too many arguments have been given to this function
 
Any ideas?
 
Crystal Reports 10
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Mar 2012 at 7:12am
date(table.field)
should also work


Edited by DBlank - 20 Mar 2012 at 7:13am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Mar 2012 at 7:40am
Ryan's version would be
date(tonumber("20" & right({table.field},2)),tonumber(left({table.field},2)),tonumber(mid({table.field},4,2)))
IP IP Logged
docmig
Newbie
Newbie
Avatar

Joined: 18 Mar 2012
Location: United States
Online Status: Offline
Posts: 3
Quote docmig Replybullet Posted: 20 Mar 2012 at 10:42am
Many thanks!
Worked perfectly.
IP IP Logged
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