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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extract month and day from date field

Status
Not open for further replies.

Karchan

Technical User
Mar 22, 2012
9
CA
Hello, I was wondering how to extract JUST the month and day of a date field (yyyy/mm/dd) in Crystal? Example for 2014/01/06 I just need 01/06. Eventually I need this field to do a datediff with another month/day field so just changing the formatting doesn't work. TIA.
 
hi,

You about the Year() and Month() functions?

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Yeah but that just extracts part of the date, no? I figured a workaround by defaulting the year to 1999 for all the date fields. Example: date(1999,month(datefield),day(datefield)). This way I can retain it in a date format for when I do a datefiff function.
 
Still having some trouble... the problem is between Dec 31 and Jan 1. How do you make Crystal count this as a datediff of 1 day instead of 364?
TIA.
 
You must use the ACTUAL dates!

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
All you need to do is use the original date field, and format it so that it does not display the year:

> Right click - Format Field
> Customize
> Year - None


Cheers
Pete.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top