"2023-02-01 13:00:00".split(' ')[0].split('-')[2] // 01
// или
"2023-02-01 13:00:00".match(/\d{4}-\d{2}-(\d{2})\s\d{2}:\d{2}:\d{2}/)[1] // 01
// или
"2023-02-01 13:00:00".replace(/\d{4}-\d{2}-(\d{2})\s\d{2}:\d{2}:\d{2}/, '$1') // 01
// или
new Date("2023-02-01 13:00:00").getDate() // 1
// или
new Date("2023-02-01 13:00:00").getDate().toString().padStart(2,0) // 01
const parentSelector = '.parent';
const className = 'custom';
document.querySelectorAll(`${parentSelector} > .${className}`).forEach(n => {
n.classList.remove(className);
});
// или
for (const n of document.querySelector(parentSelector).children) {
n.className = n.className.replace(RegExp(`(^| )${className}(?= |$)`), '').trim();
}
const formatter = new Intl.DateTimeFormat('en-US', {
timeZone: 'America/New_York',
weekday: 'long',
hour12: false,
hour: 'numeric',
minute: 'numeric'
});
const parts = formatter.formatToParts(new Date()).reduce((acc, entry) => ({
...acc,
[entry.type]: entry.value
}), {});
console.log(parts); // {weekday: 'Thursday', literal: ':', hour: '12', minute: '19'}
setTimeout (function(){
$(this).removeClass('selected');
}.bind(this), 1000);
$(function() {
$(document).on('click touchstart', '.selector', function(){
console.log($(this));
});
});
button:active, button:focus {
outline: none;
}
button::-moz-focus-inner {
border: 0;
}