DateTime

  • Thread starter Thread starter bbawa1
  • Start date Start date
B

bbawa1

Hi,

I have a column of datatype DateTime. I need to retrieve data from
last 14
days old.

I am doing like this but it doesn't work.

Select reveiveddate from table1
where receiveddate = GetDate()-day(14)
 
If you date is a DateTime Object (no string, no...), you can use:

DateTime yesterday = DateTime.now();

yesterday.AddDays(-14);

You can use as well AddMonths, ...

Good Luck
Braulio


/// ------------------------------
/// Braulio Díez
///
/// http://www.tipsdotnet.com
/// ------------------------------
 
Back
Top