asp.net - Adding a number to a date -


what need in program need add arrival date , nights staying , have display textbox called departure date. format arrival date in "##/##/##" context , nights staying integer between 1 , 14.

i have of code rest of program completed, not know how this. dont know how take integer , add date in display box, after added together, displays date x amount of days after arrival days. x nights staying.

i appreciate this.

use datetime.adddays add number of days in datetime object like:

datetime arrivaldate = new datetime(2014,03,10);   datetime departuredate = arrivaldate.adddays(1); // add 1 day 

to formatted date use tostring custom datetime formats

string formatteddate = departuredate.tostring("dd/mm/yy", cultureinfo.invariantculture); 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -