Andrew86 Posted January 6, 2013 Share Posted January 6, 2013 Good day, i'll want to add 30 minutes on clock. This is my current script: <script type="text/javascript"> <!-- var currentTime = new Date() var hours = currentTime.getHours() var minutes = currentTime.getMinutes() if (minutes < 10){ minutes = "0" + minutes } document.write(hours + ":" + minutes + " ") if(hours > 11){ document.write("PM") } else { document.write("AM") } //--> </script> </h4> Thank you ! Link to comment Share on other sites More sharing options...
shacker Posted January 7, 2013 Share Posted January 7, 2013 for do what? Link to comment Share on other sites More sharing options...
Andrew86 Posted January 7, 2013 Author Share Posted January 7, 2013 Only add 30 minutes ! Link to comment Share on other sites More sharing options...
shacker Posted January 7, 2013 Share Posted January 7, 2013 you cna add in any tpl file section of your theme, but place a {literal} before the script and {/literal} at the end Link to comment Share on other sites More sharing options...
Andrew86 Posted January 7, 2013 Author Share Posted January 7, 2013 (edited) You don't understand ! If i add 30 minutes, what form i must add? Edited January 7, 2013 by Andrew86 (see edit history) Link to comment Share on other sites More sharing options...
Andrew86 Posted January 7, 2013 Author Share Posted January 7, 2013 you cna add in any tpl file section of your theme, but place a {literal} before the script and {/literal} at the end the current javascript is correct and i can see clock correctly, but i'd want add a form that add 30 minutes! for example: now are 13.45 + 30 minutes = 2.15 ! how i can add 30 minutes!? Link to comment Share on other sites More sharing options...
shacker Posted January 8, 2013 Share Posted January 8, 2013 where you need the form? can you explain the idea? Link to comment Share on other sites More sharing options...
Andrew86 Posted January 8, 2013 Author Share Posted January 8, 2013 The question was not difficult...by the way, this is the solution for "add + minutes" : <script type="text/javascript"> <!-- var twentyMinutesLater = new Date() twentyMinutesLater.setMinutes(twentyMinutesLater.getMinutes() + 30); var ore = twentyMinutesLater.getHours() var minuti = twentyMinutesLater.getMinutes() if (minuti < 10) minuti = "0" + minuti var suffix = "AM"; if (ore >= 24) { suffix = "PM"; ore = ore - 24; } if (ore == 0) { ore = 00;} if (ore < 10) { ore = "0" + ore } document.write(ore + ":" + minuti + " ") //--> </javascript> Link to comment Share on other sites More sharing options...
shacker Posted January 8, 2013 Share Posted January 8, 2013 but this dont put in a form Link to comment Share on other sites More sharing options...
Recommended Posts