What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-20 10:53:04
get only date from datetime javascript
var currentDate = new Date(); var date = currentDate.getDate(); var month = currentDate.getMonth(); //Be careful! January is 0 not 1 var year = currentDate.getFullYear(); var dateString = date + "-" +(month + 1) + "-" + year; Add solution -
Javascript 2021-09-20 07:41:03
showing difference between dates in minutes js
const today = new Date(); const endDate = new Date(startDate.setDate(startDate.getDate() + 7)); const days = parseInt((endDate - today) / (1000 * 60 * 60 * 24)); const hours = parseInt(Math.abs(endDate - today) / (1000 * 60 * 60) % 24); const minutes = pa... Add solution -
Other 2021-09-07 05:34:02
does not conform to the required format. The format is "yyyy-MM-ddThh:mm" followed by optional ":ss" or ":ss.SSS".
export function toDatetimeLocal(){ const date = new Date(), ten = (i)=> ((i < 10 ? '0' : '') + i ), YYYY = date.getFullYear(), MTH = ten(date.getMonth() + 1), DAY = ten(date.getDate()), HH = ten(date.getHours()), MM... Add solution -
Javascript 2021-09-04 07:36:02
typescript/JavaScript time ago from datetime
/** * A function that converts date object to human readable time ago * @param {Date} date * @returns {string} * @author [YogPanjarale](https://github.com/YogPanjarale) */ export function dateToTimeAgo(date: Date): string { const now = new Date(Dat... Add solution
Best helpers
Ranking is empty