12,070,942 members (61,785 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
 CHill60 250 OriginalGriff 153 Dave Kreskowiak 150 Sascha Lefèvre 110 Wonde Tadesse 100
 Dave Kreskowiak 2,276 OriginalGriff 1,654 Richard MacCutchan 1,535 CHill60 1,179 CPallini 1,122