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!

Need help converting text to numbers then translate time 1

Status
Not open for further replies.

mustang83

Technical User
Jan 10, 2013
3
US
Hello, I'm relativley new to crystal and reporting. I'm sure I am over thinking this, but am not having any luck. Basically, I have a time value formatted as text, and times are stored as the number of seconds since midnight. I need to convert this text to a number, and then add to those seconds 00:00:00 (12:00am) to show the actual time of day.

This is what i have written, but all i get back is, "12:00:00AM"

//Looks for only fields with time
If {table.field} =10
//Convert text to number, number in seconds to time
then TimeValue (tonumber({table.field}))

Any thoughts would be greatly appreciated!
 
If you are only interested in time and not the date you can use this

If {table.field1} =10
Time(dateadd("s", tonumber(table.field2), datetime(1900,01,01,0,0,0)))

Then in report designer format time as you want

Ian
 
Thanks IanWaterman, I did what you suggested, however, my formula field is not returning anything? The value is, 41820.

Thoughts?
 
Ian's formula should work. It won't show anything if {table.field1} doesn't equal 10, so you should try inserting a maximum on the formul to see whether you have any records that meet this criterion.

-LB
 
Thanks IanWaterman and lbass, you were correct, i actually mistyped the tabled and didn't even realize it this morning. Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top