Hi Barry, Thanks for the suggestions. I've just come up with a quick hack which will do what I need, so I guess I'll just go down this track:
<cfset stringVal = "0.00208101851852"> <cfset multiplicationFactor = 24 * 60 * 60> <!--- hours x minutes x seconds ---> <cfset timeInSeconds = stringVal * multiplicationFactor> <cfoutput>#timeInSeconds#</cfoutput> <!--- Now we need to convert this to minutes and seconds ---> <cfset minutes = Int(timeInSeconds / 60)> <cfset seconds = timeInSeconds - (minutes * 60)> <cfoutput>#minutes#:#seconds#</cfoutput> Not overly pretty, but it seems to work... 2009/3/17 Barry Beattie <[email protected]> > > a couple of quick points: > > 1) what you "see" is a string representation of a date or time. If > it's a true dateTime object, the underlying value is a decimal > (starting from the Epoch time? can't remember) > > 2) if you're after a formatting function in CF to convert this decimal > to a string that represents a time value, timeformat() may be of > assistance there > > TimeFormat(time [, mask ]) > > > http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&file=00000651.htm > > 3) IIRC, in many cases underlying dateTime objects, while you may be > interested in only the time value, also have a date aspect to them. > It could be something like Jan 1 year 100 (again, memory fails me > exactly) > > gota go. good luck > barry.b > > > > > > > On Tue, Mar 17, 2009 at 10:30 AM, Andrew <[email protected]> wrote: > > > > Hi, > > > > I've got an excel spreadsheet which I am parsing with cfHSSF (http:// > > cfhssf.riaforge.org/) > > > > In it are a few time fields (elapsed times, like 2 mins, 50 seconds) > > which are returned as something like this: 0.00208101851852 > > > > Is there an easy way to convert that to minutes and seconds in CF? In > > Java I can use POI to return it as a date, and then format it like > > this: > > > > DateFormat df = new SimpleDateFormat("m:ss.S"); > > System.out.println(df.format(cell.getDateCellValue())); > > > > Does CF have a simple way of converting the float value to a date? I > > have seen an IsNumericDate function, which returns true for this > > value, but I can't see a method which allows you to create a date from > > a float. Am I missing something? > > > > I guess I could just do it in Java if all else fails, but I was hoping > > to keep it all in CF if possible. > > > > Thanks, > > Andrew. > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en -~----------~----~----~----~------~----~------~--~---
