Solved

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

Posted on 2007-03-22
4
21,956 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

751 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