Home > front end >  Front end when how to split second transformation with a timestamp, thank you for your bosses
Front end when how to split second transformation with a timestamp, thank you for your bosses

Time:05-14

'22:17:33', when the background to the string, how to translate into Number type timestamp, and front-end display when it is too minutes format conversion, again thank you bosses give directions,

CodePudding user response:

Var hours='22:17:33';//time
Var date=new date (' 1970-01-01 '+ hours);//into the date, need to increase the default date 1970-01-01
Var timespan=date. GetTime ()//get the current date timestamp

Var date1=new Date (timespan)//timestamp value Date is 1970-01-01 22:17:33
Var dt=date1. GetHours () + ', '+ date1. GetMinutes () +', '+ date1. GetSeconds 22:17:33 ()//get the date time value
  • Related