Last active
June 13, 2018 23:57
-
-
Save AminBusiness/eaf1bacdea8c20c17fe312177e0d84d9 to your computer and use it in GitHub Desktop.
// source https://jsbin.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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