• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 397
  • Last Modified:

How do you add 2 hours to a timeformat in coldfusion 8

I currently am trying to use a time variable (timeformat) and add two hours to the time in the variable. How would you go about doing such a thing? I'm currently using the code in the snippet as a reference.
<cfsetTimeShown = 8:00 pm>
<cfschedule action="Update" task="#FORM.ShowingID#" operation="httprequest"
    Startdate="#DateFormat(DateShown,"mm/dd/yyyy")#"
    Starttime="#TimeFormat(TimeShown)#"
URL=""
    interval="300" 
    Requesttimeout="600" >

Open in new window

0
jasch2244
Asked:
jasch2244
  • 4
  • 2
2 Solutions
 
PluckaCommented:
dateAdd("h", 2, dateVariable)

You might need to convert your TimeShown to a dateObject if it's not already, you can use createDateTime for that.
0
 
jasch2244Author Commented:
Is there a way to do it with out a date variable? I need to insert a time specifically into cfschedule, that's why I used: TimeFormat(TimeShown). Could you show me the code I"m a complete newb.
0
 
PluckaCommented:
I would need to know what your TimeShow looks like what format is it paste an example ie

14:50
12:20 am

If you can tell me what it looks like, I'll post the code.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
PluckaCommented:
It might just work like this

Starttime="#TimeFormat(TimeShown)#"

Starttime="#TimeFormat(DateAdd("h", 2, TimeShown))#"
0
 
jasch2244Author Commented:
Thank you that works great for the time increase for two hours. Could you give me an example of where you would increment a date value by say 2 days? I would be happy to accest as a multiple solution. Thank you, thank you!
0
 
PluckaCommented:
Its the same

dateAdd("d", 2, dateVariable)

note the h changed to a d (hours to days)
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now