Solved

DateFormat Function in VS 2008

Posted on 2014-02-21
3
143 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
  • 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

How our DevOps Team Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

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…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

825 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