| Author |
Message |
pjgreports
Newbie
Joined: 29 Jul 2011
Online Status: Offline
Posts: 14
|

Topic: Convert Date Posted: 01 Aug 2011 at 11:21am |
I have a field {PAUDIT.DATE} in my report that brings the date displayed as YYYYMMDD. example: 20110601. I need to convert date to 06/01/2011/ . I have tried using CDATE function but i am having no luck unless i am doing something wrong here. Can anyone help ? Thanks in advance !
|
IP Logged |
|
|
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|

Posted: 01 Aug 2011 at 11:52am |
date(mid({PAUDIT.DATE},5,2) + '/' + right({PAUDIT.DATE},2) + '/' + left({PAUDIT.DATE},4))
|
IP Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|

Posted: 01 Aug 2011 at 11:54am |
|
once it is set as a date type field you can make it formatted to whatever you preference is using the field format options in the Format Editor and Date tab
Edited by DBlank - 01 Aug 2011 at 11:55am
|
IP Logged |
|
jason stratom
Newbie
Joined: 17 Feb 2011
Location: India
Online Status: Offline
Posts: 21
|

Posted: 02 Aug 2011 at 11:20pm |
|
Hi ,
Right click on that field in the report
Format field-->custom style-->customise and Date.
In the date tab u can choose your own date format.
Try this it will be simple.........or else if u r using SQL cmd
convert(varchar(10),(ur date field),104)......also u can try for numbers from 101 to 110..........
Regards,
Jason
Edited by jason stratom - 02 Aug 2011 at 11:21pm
|
IP Logged |
|
pjgreports
Newbie
Joined: 29 Jul 2011
Online Status: Offline
Posts: 14
|

Posted: 04 Aug 2011 at 10:18am |
Thank you for the info. i have implemented this.
date(mid({PAUDIT.DATE},5,2)+'/'+right({PAUDIT.DATE},2)+'/'+left({PAUDIT.DATE},4)) . I now cannot get passed the error " A string is required here." This is a string and when I click ok it goes to the date function.
|
IP Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|

Posted: 04 Aug 2011 at 10:49am |
is {PAUDIT.DATE} a numeric or string type field? My original post assumed it was a string.
If it is numeric try
date(mid(totext({PAUDIT.DATE},0,''),5,2)+'/'+right(totext({PAUDIT.DATE},0,''),2)+'/'+left(totext({PAUDIT.DATE},0,''),4)) Edited by DBlank - 04 Aug 2011 at 11:56am
|
IP Logged |
|
pjgreports
Newbie
Joined: 29 Jul 2011
Online Status: Offline
Posts: 14
|

Posted: 05 Aug 2011 at 5:36am |
|
Yes this is a string data type. example of data in field is 20110601. I get an error: "Too many arguments have been given to this function."
|
IP Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|

Posted: 05 Aug 2011 at 8:34am |
using my original suggestion
date(mid({PAUDIT.DATE},5,2)+'/'+right({PAUDIT.DATE},2)+'/'+left({PAUDIT.DATE},4))
make sure you are using this as crystal syntax (not basic syntax)
|
IP Logged |
|
pjgreports
Newbie
Joined: 29 Jul 2011
Online Status: Offline
Posts: 14
|

Posted: 08 Aug 2011 at 7:49am |
|
That worked ! Thanks so much for your help !
|
IP Logged |
|
|
|