1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-03-14 01:52:38 +00:00
comunicapiv2/src/utils/DateUtils.ts

21 lines
466 B
TypeScript

/**
* Date utilities
*
* @author Pierre HUBERT
*/
export function time() : number {
return Math.floor((new Date()).getTime()/1000);
}
/**
* Get the current date formatted for the "DATETIME" object of
* a MySQL database
*/
export function mysql_date() : string {
const date = new Date();
return date.getFullYear() + "-" + (date.getMonth()+1) + "-" + (date.getDate() + 1)
+ " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
}