I want to insert date value in my database I have a class which have a date time attribute like this
public DateTime BookingDate { get; set; }
I have a date picker in my xaml page named datepicker . I want to insert only date value , How to get date using c#??
You can use the Date
Property , follow the documentation
DateTimeOffset sourceTime = YourDatePicker.Date;
BookingDate = sourceTime.DateTime;
To convert back to offset and bind to datetimepicker
DateTime newBookingDate;
newBookingDate = DateTime.SpecifyKind(BookingDate, DateTimeKind.Utc);
DateTimeOffset bindTime = newBookingDate;
YourDatePicker.Date = bindTime;