so i have a stored proc that i am passing in datetime params too return the data... The problem is i want to pass in default dates and times but not sure how to do this as i can only see datetime.now... here is my code...
public void RefreshLabeldata(int selectedProduct, DateTime shiftStart, DateTime shiftEnd)
{
BizManager biz = new BizManager();
DataSet dt = new DataSet();
dt = biz.GetTotalPacked(
shiftStart
, shiftEnd
, selectedProduct).DataSet;
labeltotal.Text = dt.Tables[0].Rows[0]["TotalPacked"].ToString();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Refreshdata(214, DateTime.Today, DateTime.Today.AddDays(1).AddMinutes(-1));
BindDropDownList();
RefreshLabeldata(214, DateTime.Today , DateTime.Today);
...
}
...
}
I want to pass in the date that my sql stored proc accepts i.e shiftStart 2016-06-06 06:00 shiftEnd 2016-06-06 14:00.
I know my datetimes are all wrong :) i am still trying to figure this part out.
I Think this help for you ...
Refer this link :http://www.csharp-examples.net/string-format-datetime/