Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: String to Date convert Post Reply Post New Topic
Author Message
Takesen
Senior Member
Senior Member


Joined: 29 Dec 2008
Location: United States
Online Status: Offline
Posts: 143
Quote Takesen Replybullet Topic: String to Date convert
     Posted: 05 Jan 2009 at 11:11am
Hi again =D
i'm still using CRXI annnd....
I'm trying to take a data field which is stored as a string and convert it into DateTime. I've been trying to play around with the actual functions in crystal reports... doesn't come up with a syntex error but at report launch it comes up with "Bad date format string."
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Jan 2009 at 1:24pm
are you using the cdatetime in a formula field?
IP IP Logged
Takesen
Senior Member
Senior Member


Joined: 29 Dec 2008
Location: United States
Online Status: Offline
Posts: 143
Quote Takesen Replybullet Posted: 05 Jan 2009 at 1:59pm
I was using the
 
DateTime() function in CRXI i didn't see any cDateTime()
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Jan 2009 at 2:18pm
They are basically the same thing.
Can you answer the following to help assist you:
1. What exactly are you converting (sample data),
2. Where are you converting it (in a formula, in a select statement, etc.) 
3.  if it is in a formula field are you using that formula field anywhere else?
Thanks.
IP IP Logged
Takesen
Senior Member
Senior Member


Joined: 29 Dec 2008
Location: United States
Online Status: Offline
Posts: 143
Quote Takesen Replybullet Posted: 05 Jan 2009 at 2:46pm

it's a simple date stored as a string.

ie.

20081201
20081202
20081203
20081204
 
I'm trying to convert it in a formula. The formula's only to convert the date.
 
Thank you.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Jan 2009 at 3:04pm

You can use the IsDateTime(field) to check to see if that can be converted to a datetime as it is. I think it may be handling it as a number which is too large to be considered a date.

if the IsDateTime(field) returns true then it can be converted, or false means it cannot be converted.
If it is false you may have to parse that field into something it would accept like "2008,12,01" and convert the parsed field.
IP IP Logged
Takesen
Senior Member
Senior Member


Joined: 29 Dec 2008
Location: United States
Online Status: Offline
Posts: 143
Quote Takesen Replybullet Posted: 05 Jan 2009 at 3:36pm
Alright. will do
Thank you
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