TimeSpan.TryParse(String, String, TimeSpan) Method

Top 

Description

Attempts to convert a string value into a TimeSpan value.

 

Timing Precision Mode

This page describes functionality in nanosecond timing precision mode.

 

Method Signature

TimeSpan.TryParse(

String value,


String units,


TimeSpan result)

 

 

Arguments

value


Description:

A decimal string representation of a TimeSpan in the specified units.

 

 

units


Description:

The units with which to interpret the TimeSpan string.

Valid Values:

Value

Label

"day"

days

"hr"

hours

"min"

minutes

"s"

seconds

"ms"

milliseconds

"us"

microseconds

"ns"

nanoseconds

 

 

 

result


Description:

The parse result.

Units:

s

 

 

 

Return Value

Type:

boolean

 

 

Returns 1 if string value was converted successfully, 0 if not.

 

Syntax

myVariable1 = TimeSpan.TryParse(myString1, myString2, myTimeSpan2);

 

 

See also

TimeSpan Object

TimeSpan.TryParse

TimeSpans Guide

Parsing Dates and Times