Home » Posts tagged "Date" (Page 2)

Archive for the 'Date' Tag

VB.NET – Date in code behind

Here is example of how we can define date in code behind: Current month name ‘ – label text for current month (e.i. September) CMonthLbl.Text = “Current month is ” & MonthName(Date.Now.Month).ToString() ‘ – label <asp:label ID=”CMonthLbl” runat=”server”> ‘ – output Current month is September Other examples: Any month name ‘ – your favorite month […]

VB.NET date and time format

Date as Monday, August 29, 2011 Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Dim dd As Date = Date.Today label1.Text = String.Format(“{0:dddd, MMMM d, yyyy}”, dd) End Sub Other formats… ‘ – month/day numbers without/with leading zeroes String.Format(“{0:M/d/yyyy}”, dt); ‘ “8/29/2011” String.Format(“{0:MM/dd/yyyy}”, dt); ‘ “08/29/2011” ‘ – day/month names String.Format(“{0:ddd, MMM d, […]

Classic ASP – Date and time formating

Code <script type=”text/vbscript”> document.write(DateAdd(“yyyy”,1,”31-Jan-10″) & “”) document.write(DateAdd(“q”,1,”31-Jan-10″) & “”) document.write(DateAdd(“m”,1,”31-Jan-10″) & “”) document.write(DateAdd(“y”,1,”31-Jan-10″) & “”) document.write(DateAdd(“d”,1,”31-Jan-10″) & “”) document.write(DateAdd(“w”,1,”31-Jan-10″) & “”) document.write(DateAdd(“ww”,1,”31-Jan-10″) & “”) document.write(DateAdd(“h”,1,”31-Jan-10 08:50:00″) & “”) document.write(DateAdd(“n”,1,”31-Jan-10 08:50:00″) & “”) document.write(DateAdd(“s”,1,”31-Jan-10 08:50:00″) & “”) </script> Output 1/31/2011 4/30/2010 2/28/2010 2/1/2010 2/1/2010 2/1/2010 2/7/2010 1/31/2010 9:50:00 AM 1/31/2010 8:51:00 AM 1/31/2010 8:50:01 AM