I have a string as Mon 03-Jul-2017, 11:00 AM/PM
and I have to convert this into a string like 11:00 AM/PM
using moment js.
The problem here is that I am unable to get AM
or PM
from the date time string.
I am doing this:
moment(Mon 03-Jul-2017, 11:00 AM, 'dd-mm-yyyy hh:mm').format('hh:mm A')
and it is working fine as I am getting 11:00 AM
but if the string has PM
in it it is still giving AM
in the output.
like this moment(Mon 03-Jul-2017, 11:00 PM, 'dd-mm-yyyy hh:mm').format('hh:mm A')
is also giving 11:00 AM
in output instead of 11:00 PM
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…