asp.net - c# check date is weekend or weekday -


dayofweek today = datetime.today.dayofweek; if (today == dayofweek.sunday || today == dayofweek.saturday) {   clientscript.registerstartupscript(gettype(), "alert", "alert('" weekend"');", true); } else {     clientscript.registerstartupscript(gettype(), "alert", "alert('" weekday"');", true); } 

from line above able find if today weekend or weekday

now want date user input tried fail,

my text input format : 2016-10-04

string dateinput = datetextbox.text; dayofweek today = datetime.dateinput.dayofweek; 

use datetime.parseexact parse string datetime

string dateinput = datetextbox.text; //"2016-10-04" datetime dtresult = datetime.parseexact(dateinput, "yyyy-mm-dd", cultureinfo.invariantculture); dayofweek today = dtresult.dayofweek; 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -