|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
kamalludinega Smarty n00b
Joined: 12 Dec 2014 Posts: 3
|
Posted: Fri Dec 12, 2014 7:44 am Post subject: Get remaining hours from two dates |
|
|
Hello, i want to ask about how to get remaining hours from two dates
ex :
12-11-14 - 12-10-14
the result I expect is in hours and minutes so it should be
24h 00m
thanks |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Dec 12, 2014 1:31 pm Post subject: |
|
|
This is not Smarty question.
Code: | $ php -r 'print gmstrftime("%j %H:%M", strtotime("2012-11-14") - strtotime("2012-10-14"));'
032 00:00 |
|
|
Back to top |
|
kamalludinega Smarty n00b
Joined: 12 Dec 2014 Posts: 3
|
Posted: Sat Dec 13, 2014 8:02 am Post subject: |
|
|
sorry for not mention it on the question, yes this is a smarty question. The date is on smarty variable |
|
Back to top |
|
kamalludinega Smarty n00b
Joined: 12 Dec 2014 Posts: 3
|
Posted: Sat Dec 13, 2014 10:35 am Post subject: |
|
|
ah I found another way,
I insert the smarty variable to javascript, and use jquery countdown
Code: | <script type="text/javascript">
{literal}
var dateTo =new Date("{/literal}{$custom[$cusstatus].date_to}{literal}"); $('#defaultCountdown').countdown({until: dateTo,format:'DHM'});
{/literal}
</script> | [/code] |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sat Dec 13, 2014 8:56 pm Post subject: |
|
|
There's absolutely no reason to use {literal} in your example. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|