0

New to MatBlazor below

 <MatDatePicker @bind-Value="@Date1"></MatDatePicker>
  1. Want to learn how to get date, format the date and get the time

  2. Does this one has time component?

Thanks

MilkBottle
  • 4,242
  • 13
  • 64
  • 146

2 Answers2

0
  1. Just get the value from variable Date1 from your component.

Example :


<MatDatePicker @bind-Value="@Date1"></MatDatePicker>

@code{
var formattedValue = Date1.ToString("dd mm yyyy");
var dateValue = Date1.Date;
var timeValue = Date1.TimeOfDay;
}

  1. As the current version, the control have implemented ToLocalTime() default.
Kha Vo
  • 1
  • 1
0

Please ask 1 question at a time.

MatDatePicker is based upon mat-datepicker Best would to look into material design and the ui components for answers to your question

Even though it is for Angular, it gets close, for example look at Angular 6 material: how to get date and time from matDatepicker?

rfcdejong
  • 2,219
  • 1
  • 25
  • 51