TimeSpan.ToString(String) Method

Top 

Description

Converts a TimeSpan to a string containing a decimal number representation in units specified by the input argument. If no units are specified the value is returned in units of seconds.

 

Timing Precision Mode

This page describes functionality in nanosecond timing precision mode.

 

Method Signature

TimeSpan.ToString(

String units)

 

 

Arguments

units


Description:

The units with which to create the decimal representation.

Valid Values:

Value

Label

"day"

days

"hr"

hours

"min"

minutes

"s"

seconds

"ms"

milliseconds

"us"

microseconds

"ns"

nanoseconds

 

 

 

 

Return Value

Type:

string

 

 

A decimal string representation of the TimeSpan in units specified by the input argument. If no units are specified the value is returned in units of seconds.

 

Syntax

myString1 = myTimeSpan1.ToString(myString2);

 

 

See also

TimeSpan Object

TimeSpan.ToString

TimeSpans Guide

Parsing Dates and Times