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

need to combind date and time field

Status
Not open for further replies.

ss7415

Programmer
Dec 7, 2006
84
US
i have date_add and time_add i want combine the two fields . sometimes a record may have the same date, so i need the time to determine the max. i would like to do it in my command , im using crystal xi and oracle9i

the time should be 20:34:21.80

first record
date_add looks like 4/13/2006
time_add look like 20342180

second record
date_add looks like 4/13/2006
time_add look like 20532132
 
i would like to do it in my command"

Are you trying to convey that you're using a Command Object as the datasource, or what is this command you mention? Do you mean in a formula and you just prefer to make up terms to confuse us? ;)

We need to know what Crystal states the data types are...

You also show a time as 20xxxxx, how is it stored when it's 1 AM, as 01xxxxx, or??? What data type is this time?

Anwyay, here's a formula:

Stringvar Mytime:= {table.time_add};
Stringvar MyDate:= {table.date_add};
datetime(date(MyDate)&
time(val(left(MyTime,2)),val(mid(Mytime,3,2)),val(mid(Mytime,5,2))))

Of course I guessed at everything technical, please remember to state facts first in posts, then you can explain anything you feel appropriate, but we need to know data types, Crystal version, the database used...

I also assumed that by combine the two fields you meant to say that you want a datetime field, obviously we could just concatenate text fields together, but it doesn't serve well as a datetiime then.
-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top