remove PM from datetime string in javascript code example Example: js date remove am and pm var ampm = hours >= 12 ? 'pm' : 'am';