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 is June 
YourFavoriteMthLbl.Text = "My favorite month is " & MonthName(6).ToString() 
 ' - label 
<asp:label ID="YourFavoriteMthLbl" runat="server">
  ' - output 
My favorite month is June
First of the current month

 ' - current date 09/13/2011
 ' - 1st of the month 
FirstOfMth.Text = "From: " & DateTime.Now.Month.ToString() + "/1/" 
                   _+ DateTime.Now.Year.ToString() 
 ' - label <asp:label ID="FirstOfMth" runat="server"> 
 ' - output 
From: 09/01/2011
Month from now
 
 ' - current date 09/13/2011 
 ' - last day of the month 
MoFrmNow.Text = "End: " & DateTime.Today.AddMonth(1).AddDay(0).ToString() 
 ' - End: 09/30/2011 

Last day of the current month

 ' define var
Dim cYear, cMonth
cYear = DateTime.Now.Year 'current year needed for MoEnd range
cMonth = DateTime.Now.Month
MoEnd.Text = "End of month: " & Date.Now.Month.ToString() & "/" 
                              & DateTime.DaysInMonth(cYear, cMonth) & "/" 
                              & Date.Now.Year.ToString() & "."

End of month: 9/30/2011
Next to the current month

 ' - current date 09/13/2011 
Dim NxtMth As String NxtMth = DateTime.Now.Month + 1 
 ' - current month end or next to current month 
NextToCurMth.Text = "To: " & NxtMth.ToString() + "/1/" _ + DateTime.Now.Year.ToString() 
 ' - label <asp:label ID="NextToCurMth" runat="server"> 
 ' - output 
To: 10/01/2011
Current date in textbox
 
 ' - code behind 
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load 
DateTxtBx.Text = "Today is: " & _ DateTime.Now.ToShortDateString() 
DateTxtBx1.Text = "Different date format: " & _ DateTime.Now.Year.ToString() + "."  
                  _ + DateTime.Now.Month.ToString() + "." 
                  _ + DateTime.Now.Day.ToString() 
End Sub
 ' - textbox .NET control 
<asp:TextBox ID="DateTxtBx" runat="server"> 
 ' - date as 09/14/2011 <asp:TextBox ID="DateTxtBx1" runat="server"> 
 ' - date as 2011.9.14 ' - output 

Today is:

Different day format:

View related posts:
Month, day and year code behind format
VB.NET date and time format

OnMouseOver Pop-Up Box

code


<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>My Page</title>
<link rel="stylesheet" href="../link.css" type="text/css">
<script type="text/javascript" src="../javascript/browser_detect.js"></script>
<script type="text/javascript" src="../javascript/popup.js"></script>
</head>
<body>

PROFESSIONAL SKILLS<a onmouseover="popup('Skills and abilities not 
directly related to the position for which you are applying, however, 
they may provide additional insight into your abilities as an employee 
(Examples: typing 60 words per minute; experience with Microsoft excel, 
word and power point, etc...)')"
onmouseout="kill()" onfocus="this.blur()" 
style="color:#2A1FFF; font-weight:bold; 
font-size: 12px;" />?</a>
<textarea name="pSkills" /><%=objRS2("pSkills")%></textarea>
</body>

Creating New WordPress Theme

By Justin Laing

1. Find a theme you want to base your new theme off of. A good place to start is the default theme, but you may also want to just tweak another theme that’s closer to the look/feel you are going for.

2. Copy the existing theme to a new directory in your themes directory for example if I was making a theme called “webdesign_meetup” I might copy the “default” directory into a new directory called “webdesign_meetup”.

3. In your new theme directory edit the style.css file. You should see something
like this in that file:
/*
Theme Name: WordPress Default
Theme URI: http://wordpress.org/
Description: The default WordPress theme based on the famous Kubrick.
Version: 1.6
Author: Michael Heilemann
Author URI: http://binarybonsai.com/
*/

4. Edit the theme information. This is the information that will show up under Presentation -> Theme in the administrator.

5.Go into the WordPress administrator and change your current them to the new one you just created.

6. Now you can start customizing and see the affects in real time on your site!

 

Read more …