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

time increments

Guest
Oct 21, 2006 Oct 21, 2006

Copy link to clipboard

Copied

Hi i have a table called times

which has a list of time ie 07:00, 07:10, 07:20 so on

what i want is to let the user select a display start time ie 08:00 then select a time increment ie display every 10 mins

not sure which is the best way to do this?

any ideas
TOPICS
Advanced techniques

Views

595

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
LEGEND ,
Oct 22, 2006 Oct 22, 2006

Copy link to clipboard

Copied

For the selection time, I would use 2 dropdowns, one for the hours, one for the minutes. You could use one, but it would be a very long list.

Use a text box for the time increment.

When processing the form, turn the start time into a date-time object with some date so that you can apply date functions to it. Then write the code to achieve whatever it is you are trying to do.

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
Guest
Oct 23, 2006 Oct 23, 2006

Copy link to clipboard

Copied

ok many thanks

so say i have start time of 08:00 and a increment of 40

how would i code to display every 40 mins?

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
LEGEND ,
Oct 24, 2006 Oct 24, 2006

Copy link to clipboard

Copied

Every 40 minutes for how long?

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
Guest
Oct 24, 2006 Oct 24, 2006

Copy link to clipboard

Copied

for every 40 mins that is in my table, so if my table of times goes til 9pm that would be the finish

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
LEGEND ,
Oct 25, 2006 Oct 25, 2006

Copy link to clipboard

Copied

something like this
StartTime=CreateTime(h,m,s);
EndTime=CreateTime(h,m,s);

<cfoutput>
<cfloop condition = "StartTime lt EndTime">
#StartTime#
<cfset StartTime = dateadd("n", form.increment, StartTime)>
closing tags

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
Guest
Dec 09, 2006 Dec 09, 2006

Copy link to clipboard

Copied

LATEST
ok thanks for that got it working, i am trying to populate a list box but the time it is showing is 1 hour ahead of what it should be

IN MY TABLE
GetUser.starttime = 08:00:00
GetUser.EndTime = 12:00:00
GetUser.Increment = 60

so in my list box it should show times 08:00 to 12:00 but it shows 09:00 to 01:00

any ideas why this is?

<select name="APPT_Time">
<cfset steptime = GetUser.starttime>
<cfloop condition="DateCompare(StepTime, GetUser.EndTime) LT 1">
<cfoutput query="GetUser">
<cfset StepTime = dateadd("n", GetUser.Increment, StepTime)>
<option value="#TimeFormat(StepTime, "hh:mm:ss")#">#TimeFormat(StepTime, "hh:mm")#
</option>
</cfoutput>
</cfloop>
</select>

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