# Time Span Functions in Expressions

Time span values represent an interval of time. Time span functions perform operations on these values.

The following information describes the functions available for building expressions.

Tip:

- Any information within square brackets [ ] is optional.

## TimeOfDay

- Description
- Gets the time components of a DateTime value. Only the time part of the date is associated with the time zone.

- Format
- TimeOfDay(date)

Parameters | Required? | Data Type | Description |
---|---|---|---|

date | Yes | DateTime | Date/time to isolate the time from. |

## Time

- Description
- Creates a time value based on time components. The return value is a time span value.

- Format
- Time(days, hours, minutes, seconds, milliseconds)

Parameters | Required? | Data Type | Description |
---|---|---|---|

days | Yes | Numeric | Number of days to include in the time value. |

hours | Yes | Numeric | Number of hours to include in the time value. |

minutes | Yes | Numeric | Number of minutes to include in the time value. |

seconds | Yes | Numeric | Number of seconds to include in the time value. |

milliseconds | Yes | Numeric | Number of milliseconds to include in the time value. |

## FromDays

- Description
- Creates a TimeSpan value by specifying the number of days in a time span.

- Format
- FromDays(days)

Parameters | Required? | Data Type | Description |
---|---|---|---|

days | Yes | Numeric | Number of days. |

## FromHours

- Description
- Creates a TimeSpan value by specifying the number of hours in a time span.

- Format
- FromHours(hours)

Parameters | Required? | Data Type | Description |
---|---|---|---|

hours | Yes | Numeric | Number of hours. |

## FromMinutes

- Description
- Creates a TimeSpan value by specifying the number of minutes in a time span.

- Format
- FromMinutes(minutes)

Parameters | Required? | Data Type | Description |
---|---|---|---|

minutes | Yes | Numeric | Number of minutes. |

## FromSeconds

- Description
- Creates a TimeSpan value by specifying the number of seconds in a time span.

- Format
- FromSeconds(seconds)

Parameters | Required? | Data Type | Description |
---|---|---|---|

seconds | Yes | Numeric | Number of seconds. |

## FromMilliseconds

- Description
- Creates a TimeSpan value by specifying the number of milliseconds in a time span.

- Format
- FromMilliseconds(milliseconds)

Parameters | Required? | Data Type | Description |
---|---|---|---|

milliseconds | Yes | Numeric | Number of milliseconds. |

## Days

- Description
- Returns the days component of a time span value.

- Format
- Days(timespan)

Parameters | Required? | Data Type | Description |
---|---|---|---|

timespan | Yes | TimeSpan | Time to extract the component from. |

## Hours

- Description
- Returns the hours component of a time span value.

- Format
- Hours(timespan)

Parameters | Required? | Data Type | Description |
---|---|---|---|

timespan | Yes | TimeSpan | Time to extract the component from. |

## Minutes

- Description
- Returns the minutes component of a time span value.

- Format
- Minutes(timespan)

Parameters | Required? | Data Type | Description |
---|---|---|---|

timespan | Yes | TimeSpan | Time to extract the component from. |

## Seconds

- Description
- Returns the seconds component of a time span value.

- Format
- Seconds(timespan)

Parameters | Required? | Data Type | Description |
---|---|---|---|

timespan | Yes | TimeSpan | Time to extract the component from. |

## Milliseconds

- Description
- Returns the milliseconds component of a time span value.

- Format
- Milliseconds(timespan)

Parameters | Required? | Data Type | Description |
---|---|---|---|

timespan | Yes | TimeSpan | Time to extract the component from. |

## TotalDays

- Description
- Converts a TimeSpan value to a number of days. The return type is a double.

- Format
- TotalDays(timespan)

Parameters | Required? | Data Type | Description |
---|---|---|---|

timespan | Yes | TimeSpan | Total time span value expressed as a number of days. |

## TotalHours

- Description
- Converts a TimeSpan value to a number of hours. The return type is a double.

- Format
- TotalHours(timespan)

Parameters | Required? | Data Type | Description |
---|---|---|---|

timespan | Yes | TimeSpan | Total time span value expressed as a number of hours. |

## TotalMinutes

- Description
- Converts a TimeSpan value to a number of minutes. The return type is a double.

- Format
- TotalMinutes(timespan)

Parameters | Required? | Data Type | Description |
---|---|---|---|

timespan | Yes | TimeSpan | Total time span value expressed as a number of minutes. |

## TotalSeconds

- Description
- Converts a TimeSpan value to a number of seconds. The return type is a double.

- Format
- TotalSeconds(timespan)

Parameters | Required? | Data Type | Description |
---|---|---|---|

timespan | Yes | TimeSpan | Total time span value expressed as a number of seconds. |

## TotalMilliseconds

- Description
- Converts a TimeSpan value to a number of milliseconds. The return type is a double.

- Format
- TotalMilliseconds(timespan)

Parameters | Required? | Data Type | Description |
---|---|---|---|

timespan | Yes | TimeSpan | Total time span value expressed as a number of milliseconds. |

## Duration

- Description
- Returns the absolute value of a time span.

- Format
- Duration(timespan)

- Example
- Time(0,-5,0,0,0) represents -5 hours. Using Duration, you get a time span that represents +5 hours:

Parameters | Required? | Data Type | Description |
---|---|---|---|

timespan | Yes | TimeSpan | Time span value to get the absolute value of. |