Re: Time Rounding

2008-06-04 Thread AJ Mercer
or this

cfset minuteTime = 8 /

cfset round15 = round(minuteTime/15) * 15
cfoutput#minuteTime# : #round15#br //cfoutput

If round15 equal 60
you will need to increment the hour
and set minutes to 0

On Wed, Jun 4, 2008 at 1:36 PM, Michael E. Carluen [EMAIL PROTECTED]
wrote:

 Terry,
 Try this:
 cfoutput#minute(now())#/cfoutput
 cfset theminute = minute(now())
 cfset roundedhour = hour(now())
 cfif theminute lte 7
cfset roundedMinute = 0
 cfelseif theminute lte 23
cfset roundedMinute = 15
 cfelseif theminute lte 37
cfset roundedMinute = 30
 cfelseif theminute lte 53
cfset roundedMinute = 45
 cfelse
cfset roundedhour = hour(now())+1
cfset roundedMinute = 0
 /cfif
 cfset

 theroundedtime=createDateTime(year(now()),month(now()),day(now()),roundedhou
 r,roundedMinute,0)
 cfoutput#theroundedtime#/cfoutput

 There probably a better way that someone else may suggest, but for now you
 can start with the one above.

 Hth,

 Michael






  -Original Message-
  From: Terry Troxel [mailto:[EMAIL PROTECTED]
  Sent: Sunday, June 01, 2008 5:11 AM
  To: CF-Talk
  Subject: Time Rounding
 
  I have been asked to write a time clock application and am having trouble
  figuring how to round time to 15 minute increments based upon a punch
 time
  as our mechanical time clock does.
 
  Any help would be appreciated.
 
  Terry Troxel
 


 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306798
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Time Rounding

2008-06-03 Thread Terry Troxel
I have been asked to write a time clock application and am having trouble
figuring how to round time to 15 minute increments based upon a punch time
as our mechanical time clock does. 

Any help would be appreciated.

Terry Troxel



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306795
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Time Rounding

2008-06-03 Thread Michael E. Carluen
Terry,
Try this:
cfoutput#minute(now())#/cfoutput
cfset theminute = minute(now())
cfset roundedhour = hour(now())
cfif theminute lte 7
cfset roundedMinute = 0
cfelseif theminute lte 23
cfset roundedMinute = 15
cfelseif theminute lte 37
cfset roundedMinute = 30
cfelseif theminute lte 53
cfset roundedMinute = 45
cfelse
cfset roundedhour = hour(now())+1
cfset roundedMinute = 0
/cfif
cfset
theroundedtime=createDateTime(year(now()),month(now()),day(now()),roundedhou
r,roundedMinute,0)
cfoutput#theroundedtime#/cfoutput

There probably a better way that someone else may suggest, but for now you
can start with the one above.

Hth,

Michael






 -Original Message-
 From: Terry Troxel [mailto:[EMAIL PROTECTED]
 Sent: Sunday, June 01, 2008 5:11 AM
 To: CF-Talk
 Subject: Time Rounding
 
 I have been asked to write a time clock application and am having trouble
 figuring how to round time to 15 minute increments based upon a punch time
 as our mechanical time clock does.
 
 Any help would be appreciated.
 
 Terry Troxel
 


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306796
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4