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

DateAdd

Participant ,
Apr 11, 2017 Apr 11, 2017

Copy link to clipboard

Copied

I suspect it's a lot more simple that I'm making it.

I want to add 48 hours to a date that is stored in a table.  I first query the database (MS SQL), then insert the new date into a different field in the same table.

I tried this:

<cfset good_until_date  = DateAdd('h', 48, good_date.cc_TIC_fridge_start)>

The date that was in the database was:      2017-04-11 18:37:00.000  (this is the date I want to add 48 hour to)

The new (wrong) date is from 6 days prior: 2017-04-05 17:52:00.000

CF10

I'm sure I've done something wrong. 

Any guidance is appreciated.

Thanks!

Views

573

Translate

Translate

Report

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
Advocate ,
Apr 12, 2017 Apr 12, 2017

Copy link to clipboard

Copied

Are you sure that it using the correct date. This should work as expected, so I assume the input is wrong.

Simple example here - http://trycf.com/gist/9d3a5f7c6b9c1c904181b7d6930eb7da/undefined?theme=monokai

As you can see it works. Are you outputting cc_TIC_fridge_start or just looking in the database?

Votes

Translate

Translate

Report

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
Participant ,
Apr 18, 2017 Apr 18, 2017

Copy link to clipboard

Copied

LATEST

Sadly I was updating the incorrect date. 

Thanks, I got it to work.

Votes

Translate

Translate

Report

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
Documentation