-1

I have this date and time format 1/1/2000 20:00:00 and would like to only get the time in this form 20:00 PM or 08:00 AM

How can I format it as hh:mm a to my date?

I get it this way:

var momentDate = moment($scope.workshop.hour, 'YYYY-MM-DDTHH:mm:ss');
var jsDate = momentDate.toDate();
jsDate.toLocaleString();
mplungjan
  • 169,008
  • 28
  • 173
  • 236

1 Answers1

0

Try format with HH:mm A as an argument. The A argument will display capital AM or PM as appropriate. Here's an example to get the current time into that format.

var date = new Date()
var momentDate = moment(date);
momentDate.format('HH:mm A')

Updated

Updated to match OP's request.

GenericUser
  • 3,003
  • 1
  • 11
  • 17