We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Unable to set current time in DateTimeEdit

Thread ID:

Created:

Updated:

Platform:

Replies:

147668 Sep 19,2019 07:19 AM UTC Sep 26,2019 01:06 PM UTC WPF 5
loading
Tags: DateTimeEdit
John
Asked On September 19, 2019 07:19 AM UTC

When today button is pressed in drop down calender, it sets the today's date but resets the time to 00:00:00 if using HH format and even if I set using DateTimeEdit.DateTime = DateTime.Now; it does same thing.
Is there any way to fix it ?

Kanniyappan Panneer Selvam [Syncfusion]
Replied On September 19, 2019 11:01 AM UTC

Hi John, 
 
Thanks for contacting syncfusion support. 
 
We have checked your query “Time resets to 00:00:00 when press today button in DateTimeEdit” at our end. We can achieve your requirement by the setting the DateTime.Now value to DateTimeEdit when click today button and it can be retrieved by DateTimeChanged event of DateTimeEdit. Please find the code snippet, screenshot and sample for the same.  
 
Code Snippet: 
 
dateTimeEdit.DateTimeChanged += DateTimeEdit_DateTimeChanged; 
 
/// <summary> 
        /// Event triggers when current date time is changed 
        /// </summary> 
        private void DateTimeEdit_DateTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 
       
            dateTimeEdit.DateTime = DateTime.Now; 
        } 
 
 
Screenshot: 
 
 
 
 
Please try the above solution and let us know  if it is helpful. 
 
Regards, 
Kanniyappan P 


John
Replied On September 19, 2019 12:35 PM UTC

Hi John, 
 
Thanks for contacting syncfusion support. 
 
We have checked your query “Time resets to 00:00:00 when press today button in DateTimeEdit” at our end. We can achieve your requirement by the setting the DateTime.Now value to DateTimeEdit when click today button and it can be retrieved by DateTimeChanged event of DateTimeEdit. Please find the code snippet, screenshot and sample for the same.  
 
Code Snippet: 
 
dateTimeEdit.DateTimeChanged += DateTimeEdit_DateTimeChanged; 
 
/// <summary> 
        /// Event triggers when current date time is changed 
        /// </summary> 
        private void DateTimeEdit_DateTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 
       
            dateTimeEdit.DateTime = DateTime.Now; 
        } 
 
 
Screenshot: 
 
 
 
 
Please try the above solution and let us know  if it is helpful. 
 
Regards, 
Kanniyappan P 


Its a bug, the suggested code snippet will not allow any other date to be set than today's.  You should add a bug fix in next version.

Kanniyappan Panneer Selvam [Syncfusion]
Replied On September 20, 2019 01:41 PM UTC

Hi John, 
 
Thanks for your update. 
 
The reported behavior is not an issue, because when click the today button, we have updated Date only instead of updating DateTime.Now to DateTimeEdit. Because the time will varies based on each and every second. So only we could not update the current time value to DateTimeEdit when click the today button.  
 
Please let us know if you have any queries on this. 
 
Regards, 
Kanniyappan P 
 


John
Replied On September 25, 2019 05:24 AM UTC

Hi John, 
 
Thanks for your update. 
 
The reported behavior is not an issue, because when click the today button, we have updated Date only instead of updating DateTime.Now to DateTimeEdit. Because the time will varies based on each and every second. So only we could not update the current time value to DateTimeEdit when click the today button.  
 
Please let us know if you have any queries on this. 
 
Regards, 
Kanniyappan P 
 


Then try set dateTimeEdit.DateTime = DateTime.Now;  in Windows_Loaded event.

Kanniyappan Panneer Selvam [Syncfusion]
Replied On September 26, 2019 01:06 PM UTC

Hi John, 
 
We have checked your reported query “Provide support to update the DateTime value based on DateTimeFormat when click the today button in DateTimeEdit” and we have logged the feature request regarding your requirement and it can be tracked through below feedback portal link.  
 
 
If you have any more specification/suggestions to the feature request you can add it as a comment in the portal. 
 
This feature will be available in our upcoming Vol 3 SP1, 2019 release.  
 
Regards, 
Kanniyappan P 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon