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!

Text field to date 1

Status
Not open for further replies.

jwinsten

Programmer
Jan 26, 2007
7
US
Hello,
I'm trying to take a text field and add it to the date. The text field is the 7.5 = 7:30 am and 19.5 = 7:30pm.
I tried a couple of formulas but nothing worked. I was able to do it in sql but unsure how to do it crystal. Any suggestions would be appreciated.
Thanks
 
Try:

numbervar x := tonumber({table.texttime});
time(truncate(x),remainder(x,truncate(x))*60,0)

-LB
 
Thanks it almost worked I needed to add an if statement becasue I have null values. The other problem I have is that its giving me an error if the decimal is more than 4 numbers. How do trucate the decimal?
 
Please post the formula as you are using it, and also provide the content of the error message.

-LB
 
Actually, I see there is a numeric overflow error because time can't take a decimal. Do you want the time to show the nearest minute or do want it to show seconds also? If just minutes, you could use:

numbervar x := tonumber({table.texttime});
time(truncate(x),round(remainder(x,truncate(x))*60),0)

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top