473,378 Members | 1,346 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

day/month/year parts of a date

Hello
how do I get the day/month/year part of a date in vb.net?

sample in vb6:
day(13/10/2001) = 13
month(13/10/2001) = 10
year(13/10/2001) = 2001

Thanks
Guy
Nov 19 '07 #1
3 35671
On Nov 19, 7:37 am, Guy Cohen <GuyCo...@discussions.microsoft.com>
wrote:
Hello
how do I get the day/month/year part of a date in vb.net?

sample in vb6:
day(13/10/2001) = 13
month(13/10/2001) = 10
year(13/10/2001) = 2001

Thanks
Guy
While, you have the visual basic DataPart function:

Dim dt As New Date(2001, 10, 13) ' or As New DateTime(2001, 10, 13)

Console.WriteLine(DatePart(DateInterval.Day, dt))
Console.WriteLine(DatePart(DateInterval.Month, dt))
Console.WriteLine(DatePart(DateInterval.Year, dt))

Or you can just use the standard date properties:

Console.WriteLine(dt.Day)
Console.WriteLine(dt.Month)
Console.WriteLine(dt.Year)

--
Tom Shelton
Nov 19 '07 #2
I think I found it...
DateTime.Day was converted to DateAndTime.Day...
:)
Guy

"Guy Cohen" wrote:
Hello
how do I get the day/month/year part of a date in vb.net?

sample in vb6:
day(13/10/2001) = 13
month(13/10/2001) = 10
year(13/10/2001) = 2001

Thanks
Guy
Nov 19 '07 #3
You were sending at the same time as Tom, for the Google searchers. Take the
answer from Tom.

Cor

Nov 20 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ITM | last post by:
Does anyone have an example of an SQL query which returns rows for the year-to-date, but where the "year" commences on August 1st? e.g. select * from mytable where datefield > last august 1st ...
8
by: Zero.NULL | last post by:
Hi, We are using Month-year tables to keep the history of long transaction of our application. For example: We capture the details of a certain action in table...
14
by: Alan | last post by:
Hi everyone! I'm trying to produce a periodic financial report on projects from various departments. My database is set up with the tables tblDepartment, tblProjects, tblPeriods, and tblBudgets...
1
by: Johnny | last post by:
I have a database with a Master table and a Budget table. The Master table has all the data including these 4 fields (Enccredit, Encdebit, Credit and Debit) and related to the Budget table. The...
3
by: Bob | last post by:
I wish to group data on a report by week, month and year. Crystal reports has this ability as a built in function. Is there a quick way to do this in Access97/2000 VBA reports ? Thank you in...
3
by: S. van Beek | last post by:
Dear reader, With DatePart() you can subtract the year or the week from a date field with: DatePart("yyyy";) for the year
2
by: deepikashalini | last post by:
hi, Im storing Issue date in database. Issuedate stored as varchar. and then compare to Passing string date('03/06/2008') what is query to compare storing varchar date to passing string...
7
by: kkshansid | last post by:
i want to display it in date/ month/ year format <td><?php echo date("d/m/y",($row)); ?></td> output 01/01/70 <td><?php echo $row; ?></td> output 1977-08-09
1
by: lulu ahu | last post by:
Hi I am developing a project in asp.net using c# coding. I m new to this field. I need to add day/month/year to a text box in asp.net. I hv 3 drop-down list. when i m selecting 3 dropdown...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.