Vivek Faldu
Vivek Faldu

Reputation: 336

Convert String "2019-03-15 09:25:00" to millisecond in react-native

I need to convert this string format to millisecond.

I tried to user Moment to get millisecond

moment('2019-03-15 09:25:00','YYYY-MM-DD HH:mm:ss').milliseconds()

but it shows me 0 value.

All help is appreciated... Thanks in advance.

Upvotes: 0

Views: 494

Answers (1)

Nirmalsinh Rathod
Nirmalsinh Rathod

Reputation: 5186

valueOf will used to get milliseconds.

m = moment('2019-03-15 09:25:00', 'YYYY-MM-DD HH:mm:ss');
console.log(m.valueOf());

Upvotes: 1

Related Questions