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!

Convert number elements to date

Status
Not open for further replies.

pl1101

Programmer
Dec 5, 2009
46
I have 3 date elements that are number datatypes. The year is a number like 1,2,3...95, 98,99. Can you help me convert to a date? day and month are the same datatype as year.
 
Use
Code:
Date (YYYY, MM, DD)
The year, month and day can be database fields or formula fields that you create.

You'll probably need to put a prefix to the year number, 20 or 19. I'd suppose anything greater than 11 would need the 19 prefix.

PS. It helps to give your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods sometimes change between versions, and higher versions have extra options. In this case, it probably makes no difference.


[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
date(2000+{table.year},{table.month},{table.day})

If the year could be earlier than 2000 you would have to explain how you know that--what the rule is. Then you would replace the year part of the formula (2000+{table.year}) with a formula like this, for example:

//{@year}:
if {table.year} > 20 then
1900+{table.year} else
2000+{table.year}

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top