Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: String to date conversion Post Reply Post New Topic
Author Message
natali
Newbie
Newbie
Avatar

Joined: 15 Jan 2013
Online Status: Offline
Posts: 26
Quote natali Replybullet Topic: String to date conversion
     Posted: 28 Nov 2013 at 4:06am

I need to convert a string field that looks like this: 2/12/13 12:36:20  PM, where first number is month and then day, and year (Feb.12., 2013)

I used CDateTime function and it worked except the first number was converted as day and it gave me the wrong date -Dec.02, 2013.

How can I fix it?


IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 30 Nov 2013 at 6:35pm
Hi
 
Try this :
 
cdate(Totext((#02/12/2013#),"MM/dd/yyyy"))
 
 
Thanks,
Sastry
IP IP Logged
natali
Newbie
Newbie
Avatar

Joined: 15 Jan 2013
Online Status: Offline
Posts: 26
Quote natali Replybullet Posted: 02 Dec 2013 at 3:37am

Thank you. It worked only for that date. How can I do it for the whole field and not only for that date?

I tried to enter the field name but I got a message: Too many arguments have been given to this function.

cdate(Totext(({Receipt_Log.lastModifiedDate}),"MM/dd/yyyy"))

IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 02 Dec 2013 at 4:50am
Hi
 
 
Try this :
 
cdate(Totext({Receipt_Log.lastModifiedDate}),"MM/dd/yyyy"))
Thanks,
Sastry
IP IP Logged
natali
Newbie
Newbie
Avatar

Joined: 15 Jan 2013
Online Status: Offline
Posts: 26
Quote natali Replybullet Posted: 02 Dec 2013 at 7:19am
Thank you to trying to help me.
Now I have a different message: The remaining text does not appear to be part of the formula. And, the last bracket is highlighted.
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 02 Dec 2013 at 8:48am
Hi
 
 
cdate(Totext({Receipt_Log.lastModifiedDate},"MM/dd/yyyy"))
Thanks,
Sastry
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