Highlighted

DateAdd

Explorer ,
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

442

Likes

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

DateAdd

Explorer ,
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

443

Likes

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
Apr 11, 2017 0
Advocate ,
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?

Likes

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
Reply
Loading...
Apr 12, 2017 0
Explorer ,
Apr 18, 2017

Copy link to clipboard

Copied

Sadly I was updating the incorrect date. 

Thanks, I got it to work.

Likes

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
Reply
Loading...
Apr 18, 2017 0