c# datetimepicker : how do i get the date in the format? 1/1/2001

i am using winforms, c#, visual studio 2008

the format on the datetimepicker is set to short which means that it will just display the date like this 1/1/2001

however, i am unable to just get that and NOT the time,

for example this:

MessageBox.Show(dateTimePicker1.Value.Date.ToString());

gives me this:

11/4/2010 12:00:00AM

how do i get just 11/4/2010?

Answers


For time call ToShortTimeString():

dateTimePicker1.Value.ToShortTimeString()

For date call ToShortDateString():

dateTimePicker1.Value.ToShortDateString()

Example of both:

Console.WriteLine(DateTime.Now.ToShortDateString());
Console.WriteLine(DateTime.Now.ToShortTimeString());

Need Your Help

Google App Engine: store uploaded file in Google Cloud Storage

python google-app-engine webapp2

I have managed to create a file in GCS in the post method of a webapp2 handler of a Google App Engine application. I can't see how to copy the content of a posted file in the file created in GCS.

nginx & nodejs: connect() failed (111: Connection refused) while connecting to upstream

node.js nginx docker centos7 iojs

Before I get into it, I have looked through every similar issue I could find and nothing I found solved my problem.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.