This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: format-number and time or ???
- To: xsl-list at mulberrytech dot com
- Subject: Re: format-number and time or ???
- From: David_Marston at lotus dot com
- Date: Fri, 10 Nov 2000 15:28:50 -0500
- Cc: rob at koberg dot com
- Reply-To: xsl-list at mulberrytech dot com
Earlier I wrote:
concat(format-number($hours,'#0'),':',
format-number($minutes,'00'),':',
format-number($seconds,'00.###'))
If you start with $data containing the amount of time in seconds,
$seconds is ($data mod 60)
$minutes is ((floor($data div 60)) mod 60)
$hours is (floor($data div 3600))
If you start with $data containing the amount of time in minutes,
$seconds is (($data * 60) mod 60)
$minutes is (floor($data) mod 60)
$hours is (floor($data div 60))
If you start with $data containing the amount of time in hours,
$seconds is (($data * 3600) mod 60)
$minutes is (floor($data * 60) mod 60)
$hours is (floor($data))
The above formulae allow decimal fractions of a second to fall
through, which you'll trim in the formatting anyway. They also
allow $hours to be arbitrarily large, so you may want to expand
the format string (###0) or add another calculation for days.
.................David Marston
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list