asp.net - how to get only date part from date string in C# -


i need in format "2015-10-03" , im getting "10/3/2015" , "10/3/2015 12:00:00 am" both not working in query .because updateddate datatype date only

    fromdate = txtbox_ajaxcalfrom.text.trim();//  10/3/2015     datetime frmdt = convert.todatetime(fromdate);// 10/3/2015 12:00:00     todate = txtbox_ajaxcalto.text.trim();     datetime todt = convert.todatetime(fromdate); 

i want query this

updateddate between  '2015-10-03' , '2015-10-03'  

full query

   gvorders.datasource = getdata(string.format("select * goalsroadmap activities='{0}' , project ='" + projectname + "' , updateddate between  '2015-10-03' , '2015-10-03' ", customerid)); 

try this:

datetime frmdt = convert.todatetime(fromdate);  string frmdtstring = frmdt.tostring("yyyy-mm-dd"); 

or @ once:

string frmdt = convert.todatetime(fromdate).tostring("yyyy-mm-dd");

so code this:

fromdate = txtbox_ajaxcalfrom.text.trim();//  10/3/2015 string frmdt = convert.todatetime(fromdate).tostring("yyyy-mm-dd"); todate = txtbox_ajaxcalto.text.trim(); string todt = convert.todatetime(todt).tostring("yyyy-mm-dd");  gvorders.datasource = getdata(string.format("select * goalsroadmap activities='{0}' , project ='" + projectname + "' , updateddate between  '{1}' , '{2}' ", customerid, frmdt, todt  )); 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -