I want to get date without time. I have in sql server Date type. I try to get: liObj.innerText = shi.Date; in javascript but I get: 2022-01-22T00:00:00 How I can remove the: T00:00:00 Thank you
Asked
Active
Viewed 64 times
-1
-
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring – Teemu Jan 23 '22 at 11:34
-
`'2022-01-22T00:00:00'.split('T')[0] ` - or lot more ideas -> [here](https://stackoverflow.com/a/35393125/13658816) – jsN00b Jan 23 '22 at 11:37
2 Answers
0
String(new Date('2022-01-22T00:00:00')).split(' ').slice(0, 4).join(' ');
// 'Sat Jan 22 2022'
Ahmad Raza
- 56
- 6
0
let var1 = '2022-01-22T00:00:00'
let output = var1.split('T')[0]
console.log(output)
Muhammad Tahir Ali
- 110
- 6