This content has been marked as final. Show 6 replies
Set a string variable to "0,0,30,0"
Loop through your variable with some if/else logic to display your timespan.
That would work, but I am looking for a more efficient way to code it out.
There has got to be some sort of DateFormat type function available that parses it to how it should be displayed on screen I would hope.
as was very rightly mentioned by BKBK in your other (very similar) post
in the getting started forum, createtimespan() function returns number
so the integer part of the value returned (left of the decimal point)
will be number of full days, which you could get with #listfirst(MyTime,
the decimal part (right of the decimal point) can be converted to hours
#listfirst(24*listlast(MyTime, "."), ".")# will give you hours, while
#60*listlast(24*listlast(MyTime, "."), ".")# will give you minutes
the integer part of the above value is number of hours, while 60*decimal
part of the above value is minutes
using conditional logic (cfif/cfelse) and formatting (i.e. numberforat()
function) with the above you can display the result in the format you want
keep in mind, though, that on a server with a different locale set as
default, the decimal separator may not be a . [dot]
Yes I did have a very similar post in another section regarding several issues and this was one of them. However since I was not getting any responses on that one, I opted to work on the other issues myself....leaving only this one which I posted here :).
Your code logic works well. The end result of what I ended up using, as suggested by another user, which worked out fine was the following code:
To protect your security you will be asked to re-enter your login details after <cfoutput>#sessiontimeout *24*60# minutes</cfoutput> without any online activity.
And the end result is the page below (see bottom box):
As always I appreciate everyones input on this issue and we shall consider this closed, unless anyone else wants it open for discussion.
yes, i have seen that other suggestion.
in my suggestion i was - fbased on your other post - assuming that the
timeout value was going to be set by a user of the admin area and could
measure in days... i guess i just misread your other post...
Well you weren't as far off as you think :). Initially I was going to want to do it so it dynamically figured if it should display as days, hours, minutes, etc....but I decided that was good enough for the moment.
Also I do intend to allow the admin user to indicate the timeout value, but not as you might think. Basically I have an /install/ folder which will automatically launch if value on application.cfm
<cfparam name="application.install" default="FALSE">
Within that set of self contained pages, it will take them through a series of questions and the end results will:
1. Test database connection.
2. Allow them to indicate whether they want to offer support or not (i.e. can indicate a support email address and if so, then a support form shows within the admin tools + sends out automated emails on any errors).
3. Allow them to indicate their own time out value.
Upon completion of all of these things, it will then either write to the application.cfm OR if CFFILE is turned off, give them the code to copy and paste into the application.cfm, save and upload...which in turn includes the timeout variable.
I am extremely thorough on my applications and previously at bottom of the page had it hard coded as "will time out in 30 minutes" but decided that should be determined during install and dynamically show.
Have lots of work to do on that application before launch yet, so I didn't want to waste too much time on that single item :). THanks again!