Every line of 'iso string to date' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
9 function date (isostring) { 10 return isostring 11 }
106 getISOTimestamp(date) { 107 return date.toISOString().split('.')[0] + 'Z'; 108 }
35 function getDateTimeISO() { 36 var date = new Date(); 37 return date.toISOString(); 38 }
20 export function toISO (dateString) { 21 try { 22 return new Date(dateString).toISOString() 23 } catch (err) { 24 return null 25 } 26 }
109 function toDate (string) { 110 return new Date(Date.parse(string)) 111 }
14 function toISO(date: string) { 15 return date ? new Date(date).toISOString().slice(0, -5) + 'Z' : null; 16 }
115 export function formatIso(date) { 116 return (new Date(`${date.toDateString()} 12:00:00 +0000`)).toISOString().substring(0, 10); 117 }
170 function iso8601TimestampToDate(string) 171 { 172 var match = string.match(/(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+)(?:\.(\d+))?(?:([+-])(\d+):(\d+))?/) 173 var date = Date.UTC(match[1], +match[2]-1 || 0, match[3] || 1, 174 match[4] || 0, match[5] || 0, match[6] || 0, match[7] || 0); 175 if (match[8]) 176 date += (match[8] == "+" ? -1 : 1) * 177 ((+match[9] || 0)*60 + (+match[10] || 0))*60*1000; 178 179 return new Date(date); 180 }
256 function str2DateTime(str) { 257 258 if (!str) { 259 return 'Invalid time' 260 } 261 262 var d = new Date() 263 d.setISO8601(str) 264 return d.format('yyyy-MM-dd HH:mm:ss') 265 266 }
82 toIso8601(date: string): string { 83 // Already in ISO-8601 84 return date; 85 }