Question: I'm using a KendoUI for Angular datepicker; to define todays date, I use:

```
public value: Date = new Date();

```

What do I do if I want to display the date as todays date, minus 180 days?

This is in typescript/angular 4, etc.. as in my component.ts file:

```
import { Component, OnInit } from '@angular/core';

@Component({
   selector: 'app-record-filter-from-date',
   template: `
   <div class="form-group">
      <label>From Date:</label>
        <kendo-datepicker class="k-widget k-datepicker k-header crowd-control k-input" style="width: 100%;"
            [(ngModel)]="value"
            [format]="'dd-MMM-yyyy'"
            #dateModel="ngModel"
        ></kendo-datepicker>
</div>
`,
 styleUrls: ['./record-filter-from-date.component.css']
})

export class RecordFilterFromDateComponent implements OnInit {
  public value: Date = new Date();

  constructor() {

 }

 ngOnInit() {

 }
}

```

Answer: 
JavaScript class `Date` may be constructed passing milliseconds since 1 January 1970 00:00:00 UTC, so you can use it like:

```js
let date180DaysAgo = new Date(new Date().getTime() - 180 * 24 * 60 * 60 * 1000);
console.log(date180DaysAgo);
```

180 in the constructor is number of days to subtract, `180 * 24 * 60 * 60 * 1000` gives number of milliseconds within 180 days
```
let today = new Date();
let day = this.today.getDate() - 180;
console.log(day);

```