UNPKG

@dbnx/mysql

Version:

A powerful and enhanced ORM library for MySQL, offering query execution, model creation, and full relational management.

24 lines (23 loc) 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mysql_datetime = mysql_datetime; exports.mysql_date = mysql_date; function mysql_datetime(date) { let currentDate = date ? new Date(date) : new Date(); const day = String(currentDate.getDate()).padStart(2, "0"); const month = String(currentDate.getMonth() + 1).padStart(2, "0"); const year = currentDate.getFullYear(); const hours = currentDate.getHours(); const minute = currentDate.getMinutes(); const second = currentDate.getSeconds(); const formattedDate = `${year}-${month}-${day} ${hours}:${minute}:${second}`; return formattedDate; } function mysql_date(date) { let currentDate = date ? new Date(date) : new Date(); const day = String(currentDate.getDate()).padStart(2, "0"); const month = String(currentDate.getMonth() + 1).padStart(2, "0"); const year = currentDate.getFullYear(); const formattedDate = `${year}-${month}-${day}`; return formattedDate; }