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

Convert Number to Date Crystal Reports - 1

Status
Not open for further replies.

MrFuzzwah

MIS
Mar 28, 2011
49
US
Crystal stores my dates in the following formats -
6012008.00 (I need 06/01/2008)
11012009.00 (I need 11/01/2009)

I need to convert these Numbers to Date format for comparison to another date field in my report. I cannot seem to do it and would appreciate any help.

Thanks in advance -


Thanks as always -
 

See how this works:

whileprintingrecords;

stringvar v_number := totext(YourNumberField,"#",0);

numbervar v_year := tonumber(right(v_number,4));
numbervar v_day := tonumber(mid(v_number, len(v_number) - 5,2));
numbervar v_month := tonumber(right("0" + left(v_number,len(v_number) - 6),2));

date(v_year, v_month, v_day)
 
Or you could use a formula like this:

stringvar x := split(totext({table.number},"00000000.00"),".")[1];
date(val(right(x,4)),val(left(x,2)),val(mid(x,3,2)))

-LB

 
Thank you both for responding! I worked on this for many hours with no luck - TekTips is cool!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top