12,697,076 members (29,921 online)
Rate this:
See more:
I have developed a application
based on time interval
set in app.config file
which is a XML file.
the time interval is in
timespan structure
as
`<service updateInterval="0.00:02:00" />`

I want to convert this value to a particular
time as 10am or any particular time.
How can I do this.
any idea.
Posted 4-Oct-12 2:52am

Rate this:

## Solution 1

TimeSpan is relative. You cannot "convert" it to date-time.

You can do something like this:
`DateTime.Now.AddTicks(TimeSpan.FromSeconds(0).Ticks)`

Rate this:

## Solution 2

You can use a datetime object as base of calculations. For example

```Dim dt As DateTime = New DateTime(2012, 10, 4, 0, 0, 0)
Dim sp As TimeSpan = New TimeSpan(5000)
Dim ts As String = (dt + sp).ToShortTimeString()
```
Rate this:

## Solution 3

If I got you, you should choose the (say) `updateStartTime` (a `DateTime`) and then increment it using the `updateInterval` value.

Top Experts
Last 24hrsThis month
 OriginalGriff 218 F-ES Sitecore 160 CPallini 130 Jochen Arndt 90 Peter Leow 83
 OriginalGriff 3,681 Peter Leow 2,228 Mika Wendelius 1,753 ppolymorphe 1,617 Jochen Arndt 1,454