We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now



chrisryhal asked
Medium Priority
Last Modified: 2008-03-17
I have the below SQL Insert statement in my WinApp and I would like to make the formatting (mm/dd/yyyy) instead of the default mm/dd/yyy hh:mm

I am trying to do this an easy way without having to create a declaration first, because i know I can do it like so:

        Dim strdate As DateTime
        strdate = System.DateTime.Now
        Dim displayString As String
        displayString = Format(strdate, "MM/dd/yyyy")

\\\\\\\\\\\\\\\INSERT STATEMENT\\\\\\\\\\\\\

        strSQLInsert = strSQLInsert & "'" & Trim(System.DateTime.Now) & "',"
Watch Question

Try : convert(varchar(10), convert(datetime, getdate(), 103), 103)

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
try this, it will give you a date formated like "1/1/2006"

strSQLInsert = strSQLInsert & "'" & System.DateTime.Now.ToShortDateString  & "',"
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009
You can also use ToString() to format the DateTime however you want:

    strSQLInsert = strSQLInsert & "'" & System.DateTime.Now.ToString("MM/dd/yyyy") & "',"


They all worked, but I actually am using Idle_Minds.  I am going to award everyone points though.  Thanks for the help!!!!  I get confused sometimes when messing around with formats.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.