Solved

Convert Date to MM/DD/YYYY - VB.net

Posted on 2007-03-22
4
21,947 Views
Last Modified: 2010-05-11
Unable to convert my date properly...Using VB.net 2003

Have
Dim Currentdate as date
currentdate = Format(Date.Today, "MM/dd/yyyy")

It gives me  Mar 22 2007.  
Need it to do:  03/22/2007
0
Comment
Question by:TechMonster
  • 3
4 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 18774544
Why not just

currentDate=Date.Today
?
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18774562
currentDate=Date.Now.ToString("MM/dd/yyyy")

should work otherwise...
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 250 total points
ID: 18774578
or try...
currentDate = Format(Now, "MM/dd/yyyy")
0
 

Author Comment

by:TechMonster
ID: 18774825
Yeah..I figured out this formula..

currentdate = Format(Now, "d") ' Getting Date.  It gives me what I am looking for.  
I am actually writting this date to a SQL table which when it writes it writes: Mar 22 2007.
So, this is more of a SQL date format...

Thanks anyway..I am sure your code works too.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question