Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
Hi all....
 
Could you plz let me know that hw you get the current date in the datetimepicker? ( I need coding)
 
i have set short format property on design , but not working
Posted 24-Jan-13 0:45am
Edited 24-Jan-13 0:46am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Please check this.
 
dateTimePicker1.Value = System.DateTime.Now;
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You may set the format to custom then you will be able to get it as date format.
 
you can access the current date selected from the date time picker from .Text property in code.
  Permalink  
Comments
vinayak chavan at 24-Jan-13 6:03am
   
i need current date in short format only, .text not working
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I tested it in my System.
Setting Format to 'Short/Custom' works fine for showing only Date in the Control.
And if u want to use the current date or selected date from it, then you can use the 'Text' property of control like this:
 
label1.Text = dateTimePicker1.Text;
 
It's working fine with me.
Check out.
  Permalink  
Comments
vinayak chavan at 24-Jan-13 6:10am
   
dear all , on form load i need current date is default date in datetimepicker
how to get???
if user login tomorrow then he get tommorows date bydefault on datetimepicker
Gittu Dash at 24-Jan-13 7:21am
   
I hope you got your answer.
But dude, by default DateTimePicker control shows current date only.
I don't know if it's working perfectly in your System or not.
But this how this control behave.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

string todayDate = DateTime.Now.ToShortDateString();
 
It will give to just today's date with standard format
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Kornfeld Eliyahu Peter 265
1 Sergey Alexandrovich Kryukov 202
2 George Jonsson 185
3 King Fisher 185
4 CPallini 155
0 OriginalGriff 6,223
1 DamithSL 4,724
2 Maciej Los 4,196
3 Kornfeld Eliyahu Peter 3,894
4 Sergey Alexandrovich Kryukov 3,496


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 24 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100