Question

I have two fields that I am trying to combine into a DateTime field. The first field is a DATE field and the second field is a character field that has the time in 24hour format.

For example:

field1: 10/02/13 field2: 19:58:18

How can I get this into a DATETIME field?

Was it helpful?

Solution

The DATETIME() function will do it for you:

mdate = DATE()
mtime = TIME()

? DATETIME(YEAR(mdate), MONTH(mdate), DAY(mdate), VAL(LEFT(mtime, 2)), VAL(SUBS(mtime, 3, 2)), VAL(RIGHT(mtime, 2)))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top