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

Create a date from a 2 byte integer

Status
Not open for further replies.

zfge01

Technical User
Jul 24, 2007
9
US
My software stores dates as 2 byte integers which represent the difference in days from 01-01-1980. I need a formula to change this field on reports to a date field, no matter how many days show up for each entry in the field. For example if its 8,972 in the field, what formula do I use to conver that to a date? Thank you
 
Try:

dateadd("d",{table.2byteinteger},date(1980,1,1))

-LB
 
LB
I am teaching myself Crystal Reports so forgive this less than knowledgeable question.
Do I place that formula exactly or do I need to "define" anything, like "table"? or "D"?
THANK YOU
 
Replace {table.2byteinteger} with your field that holds the 2 byte integer.

-LB
 
I tried that in my formula workshop and I receive the message:
"The result of selection formula must be a boolean"

Here is my formula
dateadd("d", {FlightSchedule.DAY},date(1980,1,1))
 
You are most likely creating a record selection formula or some other formula that must evaluate to true or false.

What version of Crystal? In order to correctly answer your question this is needed, and in fact you should never post without this info.


Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"If you have a big enough dictionary, just about everything is a word"
--Dave Barry
 
You should be creating this formula in the field explorer (view->field explorer->formula->new). Then if you want to use it in the record selection formula you can reference the formula there.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top