'After formating date uisng moment.js, the output will be a string and not a datetime
I am using moment.js to format time, but after formating, the output will result as a string, I need the variable as a DateTime since I am using that variable to insert in the database, and insertion cannot be done successfully since the now variable is a string.
import moment from "moment";
import "moment-timezone";
let now = moment().tz("Europe/Berlin").format("YYYY-MM-DD HH:mm:ss");
console.log(typeof now); // STRING
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
