Created
August 20, 2015 04:49
-
-
Save che-wf/7c2525b01dc66d7fd708 to your computer and use it in GitHub Desktop.
Convert Time from Argentine Time to Local Time
This file contains hidden or 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
| <html> | |
| <head> | |
| <title>Convert Time from Argentine Time to Local Time</title> | |
| </head> | |
| <body> | |
| <span id="time"></span> | |
| <script> | |
| function toLocalTime(time) { | |
| var splitTime = time.split(':'); | |
| var currDate = new Date(); | |
| var y = currDate.getFullYear(), | |
| mo = currDate.getMonth(), | |
| d = currDate.getDate(), | |
| h = parseInt(splitTime[0]) + 3, | |
| m = splitTime[1], | |
| s = 0; | |
| var newTime = new Date(Date.UTC(y, mo, d, h, m, s)).toLocaleTimeString('en-US'); | |
| return newTime; | |
| } | |
| document.getElementById('time').innerHtml = toLocalTime('9:00'); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment