0
<p-calendar [showIcon]="true" [(ngModel)]="model.StartDate" name="StartDate"></p-calendar>

I have that in my HTML and I am trying to bind model.StartDate from my typescript file without success. I want to display date and time and the date should be according to the format on a user's machine. I am reading the date from an SQL datetime2(7) field. Example date is 2020-05-12 15:03:35.6830408

Please help.

Antikhippe
  • 6,316
  • 2
  • 28
  • 43
Mutongi Gava
  • 25
  • 1
  • 7

1 Answers1

1
  StartDate
  dateTime = '2020-05-12 15: 03: 35.6830408'

  ngOnInit() {
    this.StartDate = new Date(this.dateTime)
  }

After this binding date is selected

<p-calendar [showIcon]="true" [(ngModel)]="StartDate" name="StartDate"></p-calendar>
emrebaris
  • 76
  • 5