• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • Last Modified:

get dates

what's the best way to meet the following?

end date is now - 6hrs
start date is end date - 48hrs

Does this seem right?

declare @startDate as datetime
declare @endDate as datetime

Set @endDate = dateadd(hh,-6,getdate())
Set @startDate =  dateadd(hh,-48,@endDate)
1 Solution
If this isn't a trick question then yes, that seems fine.
fwstealerAuthor Commented:
i wish - no I just sux at sql :-)

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now