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!

URGENT: Funky String to Date Issue

Status
Not open for further replies.

cgordonn

MIS
Nov 21, 2001
9
US
I am working with a database that stores the Month, Day and Year of a date in 3 separate number fields. I.E...
Field 1:{month} 1.00, 2.00, 12.00 etc...
Field 2:{day} 1.00, 2.00, 31.00 etc
Field 3:{year} 2,000.00, 2,001.00, etc

I have been able to stip the zeros and commas out and convert the separate fields to a text field via these formulas...

ToText ({AGPF200.SailedMonth},0,"") returns 1,2,31, etc
ToText ({AGPF200.SailedDay},0,"") returns 1,2,12, etc
ToText ({AGPF200.SailedYear},0,"") returns 2000, 2001, etc

Now what I need is to convert these 3 separate text fields into a single date field so that I can do aging calculations (sail dates vs. current date). I have tried using the DTSToDate and CDate functions, but I cant seem to get it to work. Hopefully someone here in the forums can point me in the right direction.

As always I thank the other forums members for their support.

Regards
CGordonn
 
The values aren't stored with decimals, that's Crystal displaying it that way, just use:

cdate({AGPF200.SailedYear},{AGPF200.SailedMonth,{AGPF200.SailedDay})

-k
 
Awesome...it worked. Thanks Vampire.

Regards,
CGordonn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top