I am using Eonasdan datetimepicker. In formatting date it contains PM and AM and so I love to use it for my date in order to identify time easily. But when I am creating some condition via Javascript to calculate the total seconds of two given times with AM and PM text it alerts Nan
. What is the best solution to get the total number of seconds with AM and PM text given?
The codes are the following:
<script type="text/javascript">
var datetime_in= '06/30/2017 7:56 AM';
var datetime_out= '06/30/2017 5:16 PM';
var totalseconds= datetime_in - datetime_out;
alert(totalseconds);
</script>