sealed
class
TimeOnly
Time as it would be read from a clock.
public
TimeOnly
.
Constructor
(
int
hour
=
null
,
int
minute
=
null
,
double
second
=
null
)
public
DatePrecisions
TimeOnly
.
Precision
The amount of precision in the date
public
double
TimeOnly
.
Second
Returns the seconds as a real number
public
int
TimeOnly
.
Ticks
Returns the number of 100 nanoseconds in the time
public
TimeOnly
TimeOnly
.
WithPrecision
(
DatePrecisions
precision
)
A new object at the specified precision
public
int
TimeOnly
.
Hour
Returns the hour
public
int
TimeOnly
.
Minute
Returns the minute
public
double
TimeOnly
.
Second
Returns the seconds as a real number
public
static
TimeOnly
TimeOnly
.
Now
(
DatePrecisions
precision
=
null
)
The current time
public
virtual
object
.
GetLayoutTip
Return a layout for the hint popup
public
virtual
object
.
GetLayoutSpan
Return a layout inside a span
public
virtual
object
.
GetLayoutBlock
Return a layout inside a block
public
virtual
object
.
GetSourceReference
Return a source reference for this object
public
virtual
void
object
.
GetTexSource
(
source
)
LaTeX source code for this object
public
virtual
Icon
object
.
GetIcon
Return a icon for this object
public
virtual
int
object
.
Compare
(
value
)
Compares this object with another and returns (-1, 0, or 1)
Example 1
Example
=
Paragraph
{
"The current time is "
;
TimeOnly
.
Now
;
};
The current time is 8:39:03.286906
Example 2
Example2
=
Block
{
var
now
=
TimeOnly
.
Now
;
var
formats
=
[
"o"
,
"r"
,
"t"
,
"T"
,
"HH:mm"
,
"HH:mm:ss"
,
"HH:mm:ss.fff"
,
];
NytrilStyle
.
Heading3
{
"Format Examples"
;
};
Table
(0.5,
PadLR
(3), [
Column
.
Fit
(2"), 3"]) {
Row
{
Background
:
NytrilPalette
.
TableTitleBack
;
TextColor
:
NytrilPalette
.
TableTitleFore
;
"Formatter"
;
"Output"
;
};
foreach
(
var
format
in
formats
) {
NytrilStyle
.
ListRow
(
each0
) {
format
;
Span
{
TextFormat
:
format
;
now
;
};
}
}
}
};
Format Examples
Formatter
Output
o
08:39:03.2869270
r
08:39:03
t
8:39 AM
T
8:39:03 AM
HH:mm
08:39
HH:mm:ss
08:39:03
HH:mm:ss.fff
08:39:03.286