<p>I'll regularly get an extract from a DB/2 database with dates and timestaps formatted like this:</p>

<pre><code>2002-01-15-00.00.00.000000
2008-01-05-12.36.05.190000
9999-12-31-24.00.00.000000
</code></pre>

<p>Is there an easier way to convert this into the Excel date format than decomposing with substrings?</p>

<pre><code>DB2date = DateValue(Left(a, 4) + "/" + Mid(a, 6, 2) + "/" + Mid(a, 9, 2))
</code></pre>

<p>thanks for your help!</p>

I'm sure you could cook something up with Regex's if you really cared to. It wouldn't be any 'better' though, probably worse.
If you'll forgive a bit of C# (I havn't touched VB in years, so I don't know the function calls anymore) you could also do:
```
```
DB2string = "2002-01-15-00.00.00.000000";
DB2date = DateValue(DB2string.SubString(0, 10).Replace('-', '/'));
```
```
But again, you're not really gaining anything. Can you give an example of where your current code would break?