Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Convert string to date Post Reply Post New Topic
Author Message
annet6104
Newbie
Newbie


Joined: 11 Sep 2007
Location: Australia
Online Status: Offline
Posts: 2
Quote annet6104 Replybullet Topic: Convert string to date
    Posted: 11 Sep 2007 at 10:22pm
Hi everyone. I am new to this forum and have seen the two previous questions about converting a string to a date.  My problem is slightly different as follows:
 
The organisation I work for uses Objective EDRMS tightly integrated with Crystal Reports XI. 
 
I am trying to create a report based on - Workflow Slips using the fields Workflow and Date Completed.
 
The date completed field is brought into crystal as a STRING and presents in the report as (for example) - Wednesday, 5 September 2007 12:59:54 PM.
 
This could be because Crystal is looking at a 'view' of the workflow slip and not the actual tables themselves.
 
I need a formula to convert the results of the Date Completed field to a date such as - 05/09/2007 (DD/MM/YYYY) - not including the day of the week or time.
 
I need to do this so I can use DISTINCTCOUNT on the Date Completed field (which currently doesn’t work because each 'time' is a unique time) combined with grouping to find out how many invoices have been completed for a date or range of dates and also grouped by workflow.
 
So in effect I should be able to produce a report for a date range of a week, that looks something like:
 
General Correspondence (workflow name)
03/09/2007 - 10
04/09/2007 - 5
05/09/2007 - 20
06/09/2007 - 6
Invoice Processing (workflow name)
03/09/2007 - 525
04/09/2007 - 572
05/09/2007 - 720
06/09/2007 - 660
IP IP Logged
Keerthana_CR
Newbie
Newbie


Joined: 14 Sep 2007
Online Status: Offline
Posts: 3
Quote Keerthana_CR Replybullet Posted: 14 Sep 2007 at 1:41pm
Did you try Formatting the date field .. ( Right Click on the field in the details section or wherever you placed the date and format the field and then you can select the required format as you need)
 
Thank you
IP IP Logged
annet6104
Newbie
Newbie


Joined: 11 Sep 2007
Location: Australia
Online Status: Offline
Posts: 2
Quote annet6104 Replybullet Posted: 16 Sep 2007 at 12:31am
Because the field is being presented as a STRING field, when you select the field format the date tab is not shown.  Thanks anyway.
IP IP Logged
rnareshk
Newbie
Newbie
Avatar

Joined: 19 Jul 2007
Location: India
Online Status: Offline
Posts: 30
Quote rnareshk Replybullet Posted: 17 Sep 2007 at 2:21am
Hi,
Create a formula field , give the string in Split function. An example is given below.
 
F1:
     Split("Monday, 17 September 2007 12:55:55 PM"," ")[3]+" "+
     Split("Monday, 17 September 2007 12:55:55 PM"," ")[2]+", "+
     Split("Monday, 17 September 2007 12:55:55 PM"," ")[4]
 
Create another formula
F2:
    Date(<F1>)
Thank You,
Naresh.
IP IP Logged
wattsjr
Groupie
Groupie
Avatar

Joined: 25 Jun 2007
Location: United States
Online Status: Offline
Posts: 51
Quote wattsjr Replybullet Posted: 18 Sep 2007 at 12:29pm
Hi annet6104,
 
I have a formula that I think will work for you.
 
The cDate() will give you the date format that you want, but you need to strip off the Day of the Week part 1st.  This formula does it all, but it does assume that the date string will always have the day of the week followed by a comma-space.  In fact, it uses that first space to find where the rest oif the date starts.
 
The formula is as follows:

cDate(Mid("Wednesday, 5 September 2007 12:59:54 PM",(InStr("Wednesday, 5 September 2007 12:59:54 PM"," "))))

 
So, create a formula.
Substitute or replace the "Wednesday, 5 September 2007 12:59:54 PM" with the name of your Date String.
Then use your new formula in you date calculations.
 
Let me know how it turns out.
 
 
Regards,
-jrw
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.020 seconds.