سؤال

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?

هل كانت مفيدة؟

المحلول

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)))
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top