Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Date Formula

Status
Not open for further replies.

SBSMedicalTech

Programmer
Apr 16, 2012
21
US
I am currently using crystal reports 11.5. I need help with a crystal report formula. In my SQL dataset, I have a field titled 'LastDayOfMonth' and 'Month'. My data set should always return 10 rows. I need a formula that will take the date value in 'LastDayOfMonth' and change it to read differently.

Example data set below. I need to create 10 chart labels based on the 10 months of data in my result set.

Where I have Month = 10 below, I would need the '2011-08-31 00:00:00.000' to be changed to 'August 2011' or 'Aug 2011'. I need it to look at the month and then take whatever date I have and convert to the name convention I have posted else nothing. I hope this is clear. If not, I can try to clear it up more.

LastDayOfMonth Month

1. '2011-08-31 00:00:00.000' 10
2. '2011-09-30 00:00:00.000' 9
3. '2011-10-31 00:00:00.000' 8
4. '2011-11-30 00:00:00.000' 7
5. '2011-12-31 00:00:00.000' 6
6. '2012-01-31 00:00:00.000' 5
7. '2012-02-29 00:00:00.000' 4
8. '2012-03-31 00:00:00.000' 3
9. '2012-04-30 00:00:00.000' 2
10. '2012-05-31 00:00:00.000' 1
 
YOu can use totext

totext(yourdatefield, 'MMMM yyyy') should return August 2011 but this will sort Alphabetically so you must sort/group on original field if required.

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top