Check out example codes for "typescript datetimte". It will help you in understanding the concepts better.

Code Example 1

const d: Date = new Date(); // but the type can also be inferred from "new Date()" already

Learn ReactJs, React Native from akashmittal.com