Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Date format question Post Reply Post New Topic
Author Message
mkhenneman
Newbie
Newbie


Joined: 23 Jan 2012
Location: United States
Online Status: Offline
Posts: 7
Quote mkhenneman Replybullet Topic: Date format question
     Posted: 22 Apr 2013 at 7:57am
hello
 
the database im working with has a date field that is formatted like this.
 
20130101224400
 
i created 3 formulas:
 
convert to format
 
if length({@requested_date_remove_nulls}) = 14 then
picture ({@requested_date_remove_nulls}, "xxxx/xx/xx xx:xx:xx")
 
 
remove nulls
 
if isnull({ORU.RequestedDateTime}) then "0000/00/00 00:00:00"
else {ORU.RequestedDateTime}
 
give me just the date
 
 
 
but when i run report i keep getting a "bad date format
 string on the third formula?
 
 
any ideas?
 I assume its finding something it cant handle
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Apr 2013 at 9:44am
all 0's is not a valid date. try to make your nulls 01/01/1900
IP IP Logged
mkhenneman
Newbie
Newbie


Joined: 23 Jan 2012
Location: United States
Online Status: Offline
Posts: 7
Quote mkhenneman Replybullet Posted: 22 Apr 2013 at 10:28am
Thanks DBANK... I gave that a shot. Still getting the same error.. A little more information that I figured out

It doesn't error out if place in the detail..but does if I try to use it in a sort or group.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Apr 2013 at 11:55am
it appears you do not need the time so try
if isnull({ORU.RequestedDateTime}) then date(1900,1,1) else date(tonumber (left({ORU.RequestedDateTime},4)),tonumber(mid({ORU.RequestedDateTime},5,2)),tonumber(mid({ORU.RequestedDateTime},7,2)))
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