Date manipulation

  • Thread starter Thread starter Ruslan Shlain
  • Start date Start date
R

Ruslan Shlain

I have a functin where i am passing in number of days as sring.
Inside that function i need to select some rows based on one of the cells
that contains date, however i need to select everything that dates 30 days
back up to today. I need to convert a string in to # of days. How can i do
that? Here is my code.

if(DS.Tables[0].Rows.Count > 0)

{

DataRowCollection DR = DS.Tables[0].Select(Criteria > DateTime.Now - THIS
IS WHERE I NEED TO PUT THE NUMBER OF DAYS TO SUBTRACT);


}
 
Ruslan Shlain said:
I have a functin where i am passing in number of days as sring.
Inside that function i need to select some rows based on one of the cells
that contains date, however i need to select everything that dates 30 days
back up to today. I need to convert a string in to # of days. How can i do
that? Here is my code.

Use int.Parse to convert the string into an integer, then use

new TimeSpan (days, 0, 0, 0);

to construct a timespan for the right number of days.
 
Back
Top