15 lines
513 B
TypeScript
15 lines
513 B
TypeScript
|
|
|
|
export const splitDateTime = (date: Date) => {
|
|
|
|
|
|
let day = date.getDate().toString().padStart(2, '0');
|
|
let month = (date.getMonth()+1).toString().padStart(2, '0');
|
|
let year = date.getFullYear();
|
|
let hour = date.getHours().toString().padStart(2, '0');
|
|
let minute = date.getMinutes().toString().padStart(2, '0');
|
|
let seconds = date.getSeconds().toString().padStart(2, '0');
|
|
|
|
return {fullDate: `${year}-${month}-${day}`, fullTime: `${hour}:${minute}:${seconds}`}
|
|
|
|
} |