Skip to content

Instantly share code, notes, and snippets.

@AminBusiness
Last active June 13, 2018 23:57
Show Gist options
  • Save AminBusiness/eaf1bacdea8c20c17fe312177e0d84d9 to your computer and use it in GitHub Desktop.
Save AminBusiness/eaf1bacdea8c20c17fe312177e0d84d9 to your computer and use it in GitHub Desktop.
// source https://jsbin.com
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
//Time-Conversion from 12 hour format to 24 hour format
const arr = s.slice(0,8).split(':');
arr[0] = (s.indexOf('PM') > -1) ?
(arr[0] == 12 ? '12' : Number(arr[0]) + 12) :
(arr[0] == 12 ? '00' : arr[0]);
return arr.join(':');
</script>
<script id="jsbin-source-javascript" type="text/javascript">//Time-Conversion from 12 hour format to 24 hour format
const arr = s.slice(0,8).split(':');
arr[0] = (s.indexOf('PM') > -1) ?
(arr[0] == 12 ? '12' : Number(arr[0]) + 12) :
(arr[0] == 12 ? '00' : arr[0]);
return arr.join(':');</script></body>
</html>
//Time-Conversion from 12 hour format to 24 hour format
const arr = s.slice(0,8).split(':');
arr[0] = (s.indexOf('PM') > -1) ?
(arr[0] == 12 ? '12' : Number(arr[0]) + 12) :
(arr[0] == 12 ? '00' : arr[0]);
return arr.join(':');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment