473,322 Members | 1,719 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,322 software developers and data experts.

Using the Date() function

I need to get the current date in vb .NET. In vba I
always used the Date() function, and the help in .NET
indicates that this function still exists, but I can't
seem to find it. The Now() function works just fine, but
when I try to use Date(), I get an error. Am I missing a
reference? What is it?

Thanks,

Pat
Nov 20 '05 #1
4 1928
If you just need the date portion without the time, try:

Date.Now.Date()

Date.Now() returns the current Time and Date. .Date returns the Date portion
of the date instance only.

HTH,

Trev.
"Patrick McGuire" <an*******@discussions.microsoft.com> wrote in message
news:0c****************************@phx.gbl...
I need to get the current date in vb .NET. In vba I
always used the Date() function, and the help in .NET
indicates that this function still exists, but I can't
seem to find it. The Now() function works just fine, but
when I try to use Date(), I get an error. Am I missing a
reference? What is it?

Thanks,

Pat

Nov 20 '05 #2
"Codemonkey" <hu*********@hotmail.com> schrieb
If you just need the date portion without the time, try:

Date.Now.Date()

Date.Now() returns the current Time and Date. .Date returns the Date
portion of the date instance only.


Right. Shorter: Date.Today :-)
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
lol. I've used that before too. Call it FBFS ("Friday Brain Fried Syndrome")
on my part. ;)

"Armin Zingler" <az*******@freenet.de> wrote in message
news:eK**************@TK2MSFTNGP11.phx.gbl...
"Codemonkey" <hu*********@hotmail.com> schrieb
If you just need the date portion without the time, try:

Date.Now.Date()

Date.Now() returns the current Time and Date. .Date returns the Date
portion of the date instance only.


Right. Shorter: Date.Today :-)
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4
* "Patrick McGuire" <an*******@discussions.microsoft.com> scripsit:
I need to get the current date in vb .NET. In vba I
always used the Date() function, and the help in .NET
indicates that this function still exists, but I can't
seem to find it. The Now() function works just fine, but
when I try to use Date(), I get an error. Am I missing a
reference? What is it?


Why not use 'DateTime.Now'?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #5

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

Similar topics

4
by: Japhy | last post by:
Hello, I'm am pulling data from a mysql db and want to use the data to populate a <ul. Here are relavent parts of my code : $wohdate = mysql_result($wohRS,$wohndx,woh_date); $woh_display...
4
by: C White | last post by:
Hi I am having problems with running a query that does the following there are 5 fields in a table that the query is based on, the first four are simple enough and all that happens is that the...
16
by: John Hanley | last post by:
I created a function that breaks down a date into broken down time, I subtract a certain number of seconds from that, then use mktime() to recompute the calendar time. It works basically except...
7
by: Adrian | last post by:
I hit on this problem converting a VB.NET insurance application to C#. Age next birthday calculated from date of birth is often needed in insurance premium calculations. Originally done using...
0
by: Michelle Keys | last post by:
I am trying to call a print function to print a string from a database using javascript. Which is RC_DATA of Varchar2(2500). This is a javascript is not being used. I have a thing that needs to...
0
by: Brian Young | last post by:
Hi all. I'm using the Property Grid control in a control to manage a windows service we have developed here. The windows service runs a set of other jobs that need to be managed. The control...
6
by: ransoma22 | last post by:
I developing an application that receive SMS from a connected GSM handphone, e.g Siemens M55, Nokia 6230,etc through the data cable. The application(VB.NET) will receive the SMS automatically,...
12
by: mantrid | last post by:
Hello Can anyone point me in the right direction for the way to read a text file a line at a time and separate the fields on that line and use them as data in an INSERT to add a record to a mysql...
1
by: swethak | last post by:
hi, i have a code to disply the calendar and add events to that. It works fine.But my requirement is to i have to disply a weekly and daily calendar.Any body plz suggest that what modifications i...
6
by: BOMEz | last post by:
So i've recently been starting to program PHP in an object oriented way, but I'm running into some difficulties in from a design stand point and from an object oriented stand point: Issue 1: In my...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.