Home » Posts tagged "Date"

Archive for the 'Date' Tag

Add / Substract Date From Current Date

Add 14 days to the current date Current date: Date in 2 weeks: Markup Page Current date: <asp:TextBox ID=”TodayDt” runat=”server” > Date in 2 weeks: <asp:TextBox ID=”DaysAhead” runat=”server” > Code Behind TodayDt.Text = Date.Now.ToShortDateString DaysAhead.Text = Date.Now.AddDays(-Date.Now.DayOfWeek).AddDays(14).ToShortDateString Substract 14 days from current date Current date: Date 2 weeks ago: Markup Page Current date: <asp:TextBox ID=”TodayDt” […]

Template field databinder date format

Date 07/02/2012 DataBinder.Eval(Container.DataItem, “u_date_last_login”, “{0:d}”)

Month, day and year code behind format

Day name and date format of Friday, 11/11/2011 Dim strDayName As String Dim curTime As New DateTime curTime = DateTime.Now.ToShortDateString() strDayName = curTime.DayOfWeek.ToString Response.Write(strDayName & “, ” & DateTime.Today) Result: Friday, 11/11/2011 Day name and date format of Friday, 11/11/2011 using case funtion Dim iDay As String Dim strDayName As String iDay = DatePart(“w”, DateTime.Now) […]