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

Covert Days Hours Minutes Field to Number 1

Status
Not open for further replies.

dmt4cats

Programmer
Jun 26, 2001
15
0
0
US
I am using Crystal 7. I have a field that displays days hr:min:sec. I want to convert this field to a number so I can do calculations on it.

Following is an example of what is in the field:

203 01:21:15

Is there a way to convert this field?

Thank you for any help.
 
Hi dmt4cats,

If this is a string field it wouldn't be to difficult to split out the nbr. of days from the time using string functions. You would then have 2 fields, both strings,
1) Nbr. of days, which you could convert with tonumber.
2) Time field, Ver 7 doesn't have a "date/time conversion" function as does ver 8.0 or 8.5. (timevalue(string)).

So I think your hooped if your going to stay with Ver 7

Nuffsaid.
 
Is this a character field?
You want to convert it to the number of seconds? Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
OK....

A little more thought given here.....

If you can cope with 3 more additional fields, you can probably extract Hour, Minute, Second, convert them "ToNumber", and deal with them respectively....

Still Thinking........

Nuffsaid.
 
This is a string field. I am trying to break it down to seconds or minutes so I can calculate and then display however my customer wants.

I am looking at breaking it down to 3 separate fields with the suggestion from Nuffsaid.

Thank you,
 
dmt4cats -

I'm not sure what the customer wants to see, but can you not convert this field to a date time field and simply use the datediff() function to show elapsed days, hours, minutes, etc?

Software Support for Sage Mas90, Macola, Crystal Reports, Goldmine and MS Office
 
Is the Hours always in position 5, or does it move based on the size of the day number? Is there always a space between days and hours? Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top