-2

I have my datetimestamp in the below formats -

2019-01-30 (21:00:00.000) CST
2019-01-31 (09:00:00.000) CST

I need to convert the above dates to integers like below -

75600000
32400000

I need to implement this in angular component to perform further mathematical operations. Assistance please?

rohit
  • 495
  • 2
  • 5
  • 16
  • Add the code you have tried to solve this that isn't working for you. – justDan Feb 01 '19 at 01:31
  • 1
    Possible duplicate of [Convert normal date to unix timestamp](https://stackoverflow.com/questions/11893083/convert-normal-date-to-unix-timestamp) – Web Nexus Feb 01 '19 at 01:32
  • i wonder why this question is negatively rated. I searched for hours and found solution provided here helped me. The solution even working fine on html page when used under interpolation. – PriyankaW Dec 05 '19 at 13:43

1 Answers1

1

I think a simple + prefix will suffice.

e.g.

let date = new Date();//Fri Feb 01 2019 07:19:00 GMT+0545 (Nepal Time)

let intDate = +new Date();//1548984868016
alchi baucha
  • 860
  • 7
  • 16