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