1. Date format to time
function getTimestamp(time) { return (new Date(time)); }
2. Time to date format
function transformPHPTime(time) { var date = new Date(time * 1000); Y = () + '-'; M = (()+1 < 10 ? '0'+(()+1) : ()+1) + '-'; D = () + ' '; h = () + ':'; m = () + ':'; s = (); return Y+M+D+h+m+s; }
The above is the entire content of the simple examples of the mutual conversion of date and time brought to you by the editor. I hope everyone supports me~