Andrews, ios converted into a form of time stamp of

Converted into the form of the date stamp, in Andrews and ios different systems have compatibility issues positive

  • Under the Andrew system
    Date.parse(new Date('2018-03-30 12:00:00'))
    will be directly converted into the form of a time stamp (it simply is an integer)
  • Under ios are
    Date.parse(new Date('2018-03-30 12:00:00'))
    sorry, not converted

Solution

  • Under the system using ios
    Date.parse(new Date('2018/03/30 12:00:00'))
    yes, parsing out
  • Solution (compatibility wording)
Date.parse(new Date('2018/03/30 12:00:00')) || Date.parse(new Date('2018-03-30 12:00:00'))
  • Encapsulated utility function
function formatTimeStamp (time) {
  return Date.parse(new Date('2018/03/30 12:00:00')) || Date.parse(new Date('2018-03-30 12:00:00'))
}

 

Guess you like

Origin www.cnblogs.com/web-record/p/11635358.html