Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Concatenate date time and update SQL datetime field

Participant ,
Mar 11, 2014 Mar 11, 2014

I have a form that captures date and time in 2 separate fields data and time.

I need to combine these fileds and UPDATE a SQL database (datetime field)

The date field is passed like this  DSDATE={ts '2013-11-18 00:00:00'}

The time field is passed like this   TIME_IN1=14:05

How do I concatenate DSDATE AND TIME_IN1 so that I can insert like this 2013-11-18 14:05:00.000 ?

TOPICS
Database access
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 13, 2014 Mar 13, 2014
LATEST

The easiest way may be the best. You judge.

<cfset DSDATE = parsedatetime('2013-11-18')>

<cfset  TIME_IN1="14:05">

<cfset yr = year(DSDATE)>

<cfset mnth = month(DSDATE)>

<cfset d = day(DSDATE)>

<cfset hr = listGetAt(TIME_IN1,1,":")>

<cfset mn = listGetAt(TIME_IN1,2,":")>

<cfset datetime=createdatetime(yr,mnth,d,hr,mn,0)>

<cfoutput>#datetime#</cfoutput>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources