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!

DateTimeValue problem

Status
Not open for further replies.

Halfcan

Technical User
Dec 8, 2002
214
US
HI, I use v8.5.

Im having a problem combining 2 fields (DATE and TIME)together to create a datetime type field.

My Date field data is in this format: 07/10/2003
My Time field data is in this format: 5:15:00AM

this is my formula:
DateTimeValue (Date({Tickets.Date_Device_UP}),
Time({Tickets.Time_Device_UP} ))

I keep getting an error message: "A datetime field is required here." and the cursor is placed between (Date and((Tickets.....

In report options, Convert DateTime field to: is DATETIME

Any ideas?

Thanks,
HC
 
Please share technical information when requesting it, such as the data types being used.

Try:

DateTime({Tickets.Date_Device_UP},
Time({Tickets.Time_Device_UP} ))

The first argument should be a datetime type (I know, it's annoying), not a date. If it's a datetime in the database, then just use it directly, if not, construct a datetime from it and use it as the first argument:

DateTime(year({Tickets.Date_Device_UP}),month({Tickets.Date_Device_UP}),day({Tickets.Date_Device_UP}),0,0,0)

-k
 
Thanks synapse,

I have a DATE field, And a TIME field. Separte.

I've tried converting them into datetime type fields, but run into problems with the TIME fields.
Using this: DateTime (0,0,0,hour({Tickets.Time_Device_UP}) ,minute({Tickets.Time_Device_UP}) ,second({Tickets.Time_Device_UP}))

I get errors saying the year must be between 1 and 9999.

So are you saying that there is no way to concantinate 2 fields - a DATE and a TIME field together without converting them both to DATETIME fields first?

Also, what if the date or time record is null?

Thanks for your patience,
HC

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top