Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
i have billdate column i want to get month from billdate

suppose date is 22/06/2014 so i want month is 06
Posted
Comments
Vedat Ozan Oner 18-Jun-14 6:33am    
see here: http://msdn.microsoft.com/en-us/library/system.datetime.aspx
Manfred Rudolf Bihy 18-Jun-14 6:36am    
Need more details: Is the type of the column already datetime or is it string?
If you already have the correct type it is easy: you can use the property Month of DateTime DateTime.Month

TRY THIS.. :)

VB
Dim Month As String = DateTime.Now.ToString("MM")
 
Share this answer
 
 
Share this answer
 
The month can be extracted from the date directly at the database.
If your using MSSQL as your database, you can use the DATEPART function to achieve this.

You can use it like this:
SQL
SELECT 
     billdate 
    ,DATEPART(month, billdate) AS billMonth
FROM
    tblBilling


Hope it helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900