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

Combining 2 numeric fields

Status
Not open for further replies.

bpvsc

MIS
Apr 30, 2002
18
US
Hi,
I am using Crystal 8.5 and an AS400 database and need to combine 2 numeric fields to create a date/time field. Can anyone tell me if I need to create seperate text fields first and then how to complete?
Thanks
 
What does the raw data look like? If your date string is YYYYMMDD and the time is HHMMSS then the following will work:

stringvar tme:=totext({time.field},0,"");stringvar dte:=totext({date.field},0,"");datevar dat;timevar tim;

dat:=date(val(dte [1 to 4]),val(dte[5 to 6]),val(dte[7 to 8]));

if {time.field} in 0 to 99999 then
tim:=time(val(tme[1]),
val(tme[2 to 3]),
val(tme[4 to 5])) else

tim:=time(val(tme[1 to 2]),
val(tme[3 to 4]),
val(tme[5 to 6]));



datetime(year(dat),month(dat),day(dat),hour(tim),minute(tim),second(tim)) Mike

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top