<p>I'm trying to achieve the last possible time of a particular day eg for Date of 2008-01-23 00:00:00.000 i would need 2008-01-23 23:59:59.999 perhaps by using the dateadd function on the Date field?</p>

```
```
SELECT DATEADD(ms, -2, DATEADD(dd, 1, DATEDIFF(dd, 0, GetDate())))
```
```
I thought you had c# at first.. I will leave this here in case anyone else stumbles across this.
```
```
DateTime now = DateTime.Now;
DateTime endofDay = now.Date.AddDays(1).AddMilliseconds(-1);
```
```
You can replace the 'now' variable with whatever day you are trying to figure out