Solved

DateFormat Function in VS 2008

Posted on 2014-02-21
3
145 Views
Last Modified: 2014-02-25
Greeting,

The DateFormat.ShortDate gives me date like 2/7/2014. Is there anyway to get 02/07/2014?

Thanks.
0
Comment
Question by:mrong
[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
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39877211
Use an explicit format specifier:

Dim d As DateTime = DateTime.Now
Dim s As String = d.ToString("MM/dd/yyyy")   ' Case important!

Open in new window


A good resource for format specifiers is here:  http://blog.stevex.net/string-formatting-in-csharp/
0
 

Author Comment

by:mrong
ID: 39885428
Can I use it in VS expression? thx
0
 

Author Comment

by:mrong
ID: 39885450
Should be the following in expression

=CDate(Fields!MyDay.Value).ToString("MM/dd/yyyy")
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…

749 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