Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Extracting month from date string Post Reply Post New Topic
Author Message
jdrussell78
Newbie
Newbie
Avatar

Joined: 10 Jan 2012
Online Status: Offline
Posts: 4
Quote jdrussell78 Replybullet Topic: Extracting month from date string
     Posted: 10 Jan 2012 at 7:30am
Hi,

I am very new to Crystal reports and would appreciate it if you could help me with this.

I have a date/time field which contains data with the following format:


29/03/2011 15:11:44

and I would like to extract the month, i.e. 3.

Would someone be able to tell me how to do this ?

Thanks,

Jon
_________________
Thanks :)
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 10 Jan 2012 at 7:54am
month(table.field)
 
if you want it for display purposes only
right click on the field
selct format field
select date format tab
scroll down and select the second to the last option (3)
 
IP IP Logged
jdrussell78
Newbie
Newbie
Avatar

Joined: 10 Jan 2012
Online Status: Offline
Posts: 4
Quote jdrussell78 Replybullet Posted: 10 Jan 2012 at 7:59am
Thank you for the prompt reply.

Ok so I have set that up as a formula and that seems to be working fine.

My next step is that i need to show the number of items for each month in a bar chart.

At the moment the chart is:

On change of @month

Show values -

Count of each item.

The problem is there is only 4 for January, but it is showing 40 plus.

Thanks for your help so far.


_________________
Thanks :)
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 10 Jan 2012 at 8:06am
Do you have duplicate data rows?
Do you have multiple january months (more than 1 year) in your data set?
 
 
IP IP Logged
jdrussell78
Newbie
Newbie
Avatar

Joined: 10 Jan 2012
Online Status: Offline
Posts: 4
Quote jdrussell78 Replybullet Posted: 10 Jan 2012 at 8:12am
ha ha, no I was actually being stupid.

However, I do need to break up the data again by year, sorry, thanks for your help once again
_________________
Thanks :)
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 10 Jan 2012 at 8:14am

You can group on the date field in the graph and set it to "per month" which will break per month and per year keepin it in correct chronological order

IP IP Logged
jdrussell78
Newbie
Newbie
Avatar

Joined: 10 Jan 2012
Online Status: Offline
Posts: 4
Quote jdrussell78 Replybullet Posted: 10 Jan 2012 at 8:22am
yeah all good, what I did in the end was create a cross tab and then had a total for each month for each year, and then referenced that in a the grpah.

Thanks for all your help.
_________________
Thanks :)
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