ASP.NET - calculate date
Asked By msakt
25-Aug-11 09:05 AM
8/6/2011
waranty month =2 months(above date is calculate in warranty months)like below
i need 8/8/2011
Rohan Dave replied to msakt
you can do something like below
DateTime objDT = new DateTime(8,6,2011);
DateTime objDT1 = objDT.AddMonths(2);
console.WriteLine(objDT1.ToString());
TSN ... replied to msakt
hi..
try like this..
DateTime dt = Convert.ToDateTime(txtName.Text);
DateTime dt1=dt.AddMonths(2);
Cosmos Mysore replied to msakt
Sample 1
DateTime dt = DateTime.Now;
DateTime ds = dt.AddDays(60);
Sample 2
DateTime dt = DateTime.Now;
DateTime ds = dt.AddMonths(2);
James H replied to msakt
Hi you can do like this
DateTime dt = new DateTime(2011, 6, 8);
DateTime newDateTime=dt.AddMonths(2);

button click event not fireing hi in my asp.net page i m using file upload control to upload file. . . but when i am selecting Btn_Save.Text = = "Update" ) { bool dis_sts; if (Chk_Dispos.Checked) { dis_sts = true ; ProductProvider.Update_Fixed_Asset(ID, dis_sts, Convert.ToDateTime(Txt_Dis_Dt.Text).Date, (Convert.ToDouble((Txt_DisposValue.Text = = "" ) ? "0" : Txt_DisposValue.Text))); ProductProvider.Insert_JournalEntry(Convert.ToDateTime(Txt_Dis_Dt.Text).Date, "DISP" , Convert.ToInt32(ddlAccrunalNominalAC.Items.FindByText( "Asset Disposal" ).Value), ddlLocations.SelectedValue, "Fixed Asset" , Convert.ToInt32 0" ), (Convert.ToDouble((Txt_DisposValue.Text = = "" ) ? "0" : Txt_DisposValue.Text)), Convert.ToDouble( "0" ), 0, "Null" , Txt_Ref.Text, DateTime.Now, "none" , DateTime.Now, 0); } else { dis_sts = false ; } } else { / / Upload Image string tempfile = null ; string fullname = null ; if
Days Calculation from date how to calculate days month and year for given from date to todate ? That depends on what you want to calculate exactly. You can't translate ts.Days % 365) / 31; If you want the exact difference, you have to compare the DateTime values. have a look on http: / / www.codeproject.com / Articles / 44048 / Calculate-Difference-Between-Two you how to Calculate number of years, months and days between two given dates in asp.net using c# protected void Page_Load( object sender, EventArgs e) { DateTime dt1 = Convert.ToDateTime( "02 / 01 / 2011" ); DateTime dt2 = Convert.ToDateTime( "11 / 04 / 2010" ); / / Initializing object and then calling constructor CalculateDateDifference dateDiff = new
of days for 10 months, for generating report? HI Shanmugam Here we have need two date. which is i can specify. then after two date difference and return result using time span and get result in days. DateTime now = new DateTime (1, 11, 2005); DateTime then = new DateTime (1, 1, 2005); TimeSpan diff = now - then; int days = diff.Days; Thanks You can simply converting then to Double type using ToOADate() method.Here is the code, Double date1 = Convert .ToDateTime( "1 / 5 / 2010" ).ToOADate(); Double date2 = Convert .ToDateTime( "10 / 8 / 2010" ).ToOADate(); Double diff = date2 - date1; MessageBox .Show(diff.ToString()); I assume the
Date Conversion hi, Please any body let me know. . I want to substract one month from current date. I tried many time, but still could not possible. . If any body know. . . Plz. . Let me know. . Thanks you. . eg. . . Current date(MM / DD / YY):- 02 / 01 / 2010 I want date(MM / DD / YY):- 01 / 01 / 2010 getdate(-30) hi. . thanks for your response. . . I have declared one date. . consider any date. . . Just i want to minus one month from that date. . . . So how it will possible. . Plz let me know. . . thanks alot. . use DATEADD / DATEDIFF funtion m, 1, "24 March 2011" ) hi, thanks for your response. . i want this code in asp.net. . thanks alot. . hi , string strDate = Convert.ToDateTime(you database value). AddMonths(-1).ToString( "MM
Calendar control urgent Hi all, How to get the end of month date from calendar control when a date is selected thanks in advance vadivukkarasi.E Response.Write(System. DateTime .DaysInMonth( DateTime .Now.Year, DateTime .Now.Month)); use as: String Month = "2" ; DateTime dt2 = Convert . ToDateTime ( Month + " / 01 / 2011 DateTime newdate = dt2 . AddMonths ( 1 ); int day = ( newdate . AddDays (- 1 )). Day ; or try this. . DateTime .DaysInMonth