Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formatting Dates Post Reply Post New Topic
Author Message
mjcobb1812
Newbie
Newbie


Joined: 09 Nov 2010
Online Status: Offline
Posts: 3
Quote mjcobb1812 Replybullet Topic: Formatting Dates
     Posted: 09 Nov 2010 at 12:42am
Hi there,
 
I have some data from an as400 I am trying to use in an new report.  The date field is coming through as 1,101,031.00.  So this would be 31/10/10.  I therefore need to convert this into a date format.  I have tried doing a few bits but I keep getting a Bad Date Format....any help would be great.
 
IP IP Logged
Emir_W
Senior Member
Senior Member
Avatar

Joined: 25 Apr 2010
Online Status: Offline
Posts: 228
Quote Emir_W Replybullet Posted: 09 Nov 2010 at 1:49am
can you give us a sample for other day?
e.g.:
data 1,100,928.00  for 28/09/10 ???

my purpose is to identify which day, month and year.

Emir W
IP IP Logged
mjcobb1812
Newbie
Newbie


Joined: 09 Nov 2010
Online Status: Offline
Posts: 3
Quote mjcobb1812 Replybullet Posted: 09 Nov 2010 at 1:55am
Yes of course.  1,101,130.00 which indicates 30/11/10
 
So going from the start we have a strange 1 then a comma then Year then first number of month then a comma then second number for month then day day then a full stop and two 00.  Hope that helps
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 09 Nov 2010 at 6:06am

Okay, so this is by no way 'pretty', but it works!

 
local stringvar sDate:= left(right(replace(replace({table.date},',',''),'.',''),8),6);
local datevar dDate;
sDate:=mid(sDate,3,2) & '/' & right(sDate,2) & '/' & left(sDate,2);
If isdate (sDate) then
dDate := Date(sDate)
else dDate:= Date(0,0,0);
dDate;
 
Everywhere that it looks like a double quotation mark is two single quotation marks.
 
After you have the field placed, format it how you want (DD/MM/YY, whatever).


Edited by FrnhtGLI - 09 Nov 2010 at 6:07am
|< /\ '][' ( )
IP IP Logged
Emir_W
Senior Member
Senior Member
Avatar

Joined: 25 Apr 2010
Online Status: Offline
Posts: 228
Quote Emir_W Replybullet Posted: 09 Nov 2010 at 7:25pm
yeehaa..
you can try what FrnhtGLI suggest.


Emir W
IP IP Logged
mjcobb1812
Newbie
Newbie


Joined: 09 Nov 2010
Online Status: Offline
Posts: 3
Quote mjcobb1812 Replybullet Posted: 09 Nov 2010 at 10:17pm
Thats wicked, many thanks FrnhtGLI and Emir_W.
 
 
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