time2str
Contents: Description, Arguments, Usage, Examples, Sub-Functions, Related Functions, Source Supported Under Version: > 1.15
Description Returns formatted string for input hour, minute, and second, or for input hour fraction
Arguments and Return Values Parameters: Scalars specifying the year, month, and day, or a scalar specifying the number of hours, to be converted to a string Return Value: A string specifying that time
Usage Syntax: time2str(hours, minutes, seconds), or time2str(fractional number of hours) The user can also include an optional final input specifying number of digits of the seconds fraction to be displayed, e.g. 3 to show a time with milliseconds. This defaults to zero if omitted. The inputs specifying hours, minutes, and seconds must be in that order. They must be scalar. If using a fractional number of hours, that must be scalar. If specifying a number of digits of the seconds fraction for display, that also must be scalar. This function only returns strings in the format "hh:mm:ss" (with an option for digits after the decimal for seconds), e.g. "12:34:56" or "12:34:56.789". No other formats are implemented. This function works for any input greater than -24 hours. However, it wraps positive values greater than 24 hours, so, for instance, 36.5 hours will be converted to 12:30 (12.5 hours). When time2str() is entered without any arguments, it prints its description, as shown below.
Examples dv> time2str() Converts input time to formatted time string Scalar inputs only - no arrays! Watch out for unexpected negative inputs! Time can be input as time2str(hh, mm, ss) or time2str(hh.ff) Optional final input controls how many digits of seconds fraction will be displayed; 0 if omitted e.g. time2str(23.994311865) returns "23:59:39", and time2str(23.994311865, 2) returns "23:59:39.52" S.Marshall 08-13-2008 0 dv> time2str(12, 34, 56) "12:34:56" dv> time2str(12, 34, 56.789, 3) "12:34:56.789" dv> time2str(atod("12.582441392222")) "12:34:57" dv> time2str(atod("12.582441392222"), 0) "12:34:57" dv> time2str(atod("12.582441392222"), 1) "12:34:56.8" dv> time2str(atod("12.582441392222"), 2) "12:34:56.79" dv> time2str(atod("12.582441392222"), 3) "12:34:56.789" dv> time2str(atod("12.582441392222"), 6) "12:34:56.789012" dv> time2str(atod("-12.582441392222"), 6) "-12:34:56.789012" dv> time2str(atod("36.582441392222"), 6) "12:34:56.789012" |
DavinciWiki Mini-Nav Bar Contents
Contact Developers
All other topics
Recent Library Changes Created On: 11-18-2009 |