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

Converting the data/date to Mysql/string format

Thread ID:

Created:

Updated:

Platform:

Replies:

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

Hello,

i have the following 

SfDateTimeEdit 
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. 

C# 
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. 
 
Screenshot 

 

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

Arulraj A 


Matt
Replied On December 12, 2018 09:04 AM UTC

Hello,

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.


Regards,
Arulraj A

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