Monday, December 15, 2014

kendo ui datetimepicker to C# converting value



Get value

 entity.ExpiredDate = ParseDate(model.ExpiredDate);  
 private static DateTime ParseDate(string input)  
     {  
       return DateTime.ParseExact(input, formats, CultureInfo.InvariantCulture, DateTimeStyles.None);  
     }  
  private static string[] formats = new string[]  
   {  
     "MM/dd/yyyy HH:mm:ss tt",  
     "MM/dd/yyyy HH:mm:ss",  
     "M/dd/yyyy H:mm:ss tt",  
     "M/dd/yyyy H:mm:ss"  ,  
     "MM/dd/yyyy hh:mm tt"  
   };  


Set Value

 viewModel.ExpiredDate = entity.ExpiredDate.ToString("MM/dd/yyyy hh:mm tt", CultureInfo.InvariantCulture);       

Ensure that this project has Microsoft.Bcl.Build installed and packages.config is located next to the project file

In my Xamarin form application their was dependency Restclient on Microsoft.Bcl.Build Microsoft.Bcl. i just remove all using nuget and ...