I have added angular material date picker control in my angular project. I have to show the time along with the date. Can anyone let me know how can I show time along with the date using angular material date picker control?
Thanks
Display the current date and time in a date pickerClick the Data tab. In the Data type box, click Date and Time (dateTime). Click Format. In the Date and Time Format dialog box, in the Display the time like this list, click the option that you want, and then click OK.
The Angular Time Picker, also known as the Angular Material Time Picker is a lightweight and mobile-friendly component that allows end users to select a time value either from a pop-up time list or by entering the value directly in the text box.
You can build a custom component using the DateTime Component of the Angular MateriaL.
<h1 class="mat-title">Angular Material DatetimePicker</h1>
<form novalidate [formGroup]="form">
<mat-form-field>
<mat-placeholder>Start DateTime</mat-placeholder>
<input matInput formControlName="startDate" [matDatetimepicker]="dts" required autocomplete="false">
<mat-datetimepicker-toggle [for]="dts" matSuffix></mat-datetimepicker-toggle>
<mat-datetimepicker #dts type="datetime" openOnFocus="true" timeInterval="5"></mat-datetimepicker>
</mat-form-field>
</form>
STACKBLITZ DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With