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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Converting the data/date to Mysql/string format

Thread ID:





141394 Dec 10,2018 07:09 AM UTC Dec 12,2018 09:34 AM UTC WinForms 3
Tags: SfDateTimeEdit
Asked On December 10, 2018 07:09 AM UTC


i have the following 

DateTimeEditingMode = Mask
DateTimePatter = Custom
Format = dd/MM/yyyy H:mm

i am trying to convert to Mysql readable yyyy-mm-dd hh:mm:ss

but it doesnt allow me to get the correct time when converting

the code i have is 
Dim date As String = Convert.ToDateTime(SfDateTimeEdit3.Value).ToString("yyyy-MM-dd H:mm:ss")

it converts fine if the editing mode is default but i then cannot rely on the user putting the : between causing it to default to 00:00

Any help on this matter would be fantastic. 

Arulraj A [Syncfusion]
Replied On December 12, 2018 08:46 AM UTC

Hi Matt, 

Thanks for using Syncfusion product. 

We have analyzed your requirement. In SfDateTimeEdit control, we need to set the Value as DateTime.Now for showing the current DateTime in the Custom DateTimePattern. Please make use of the below code snippet. 

this.sfDateTimeEdit.DateTimeEditingMode = Syncfusion.WinForms.Input.Enums.DateTimeEditingMode.Mask; 
this.sfDateTimeEdit.DateTimePattern = Syncfusion.WinForms.Input.Enums.DateTimePattern.Custom; 
this.sfDateTimeEdit.Format = "dd/MM/yyyy hh:mm:ss"; 
this.sfDateTimeEdit.Value = DateTime.Now; 

Please make use of the below screenshot for your reference. 


Please check the above solution and let us know if it is helpful. 

Arulraj A 

Replied On December 12, 2018 09:04 AM UTC


Thank you.

i in the meantime worked out the issue.

it was because allow Null was True.

once i had switched to False it worked with the original code. 

Arulraj A [Syncfusion]
Replied On December 12, 2018 09:34 AM UTC

Hi Matt,

Thanks for the update.

We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you.

Arulraj A


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