MTCountdown

I've been meaning to implement this for a while, but I only just now got around to it. MTCountdown provides a set of tags that will allow you to place a countdown timer in your MT templates.

Download one of the following files, unpack it, and place countdown.pl in your plugins/ directory.

The following tags are available:

  • MTCountdown: container tag that takes one argument, until, in the following format: YYYY-MM-DD HH:MM:SS
  • MTCountdownIfYears / MTCountdownIfDays / MTCountdownIfHours / MTCountdownIfMinutes / MTCountdownIfSeconds: conditional tags that return true if there is a positive value for years, days, etc.
  • MTCountdownYears / MTCountdownDays / MTCountdownHours / MTCountdownMinutes / MTCountdownSeconds: the values calculated for the countdown timer.

Usage Example (counting down to my birthday):

<MTCountdown until="2003-05-13 14:00:00">
<MTCountdownIfYears><MTCountdownYears> years, </MTCountdownIfYears>
<MTCountdownIfDays><MTCountdownDays> days, </MTCountdownIfDays>
<MTCountdownIfHours><MTCountdownHours> hours, </MTCountdownIfHours>
<MTCountdownIfMinutes><MTCountdownMinutes> minutes, </MTCountdownIfMinutes>
<MTCountdownIfSeconds><MTCountdownSeconds> seconds</MTCountdownIfSeconds>
 until my birthday.
</MTCountdown>

Update: (2003-06-07 01:10)

  • Added tags for weeks ( MTCountdownIfWeeks and MTCountdownWeeks ).

Update: (2003-06-23 21:51)

  • Added new MTCountup tags (they work just like MTCountdown, but counting from a past date)
  • To make things a little less confusing, MTCountdown and MTCountup both take the date argument now (instead of until)
  • date can now include embedded MT tags (e.g. [MTTag ...])

template_tags=MTCountdown,MTCountdownIfYears,MTCountdownIfWeeks,MTCountdownIfDays,MTCountdownIfMinutes,MTCountdownIfSeconds,MTCountdownYears,MTCountdownWeeks,MTCountdownDays,MTCountdownMinutes,MTCountdownSeconds,MTCountup,MTCountupIfYears,MTCountupIfWeeks,MTCountupIfDays,MTCountupIfMinutes,MTCountupIfSeconds,MTCountupYears,MTCountupWeeks,MTCountupDays,MTCountupMinutes,MTCountupSeconds

28 TrackBacks

Countdown from MT Plugin Directory on May 9, 2003 12:06 AM

TITLE: Countdown URL: http://mt-plugins.org/archives/entry/countdown.php IP: 66.246.57.2 BLOG NAME: MT Plugin Directory DATE: 05/09/2003 12:06:14 AM Read More

MTCountdown from tUP | Blog on May 9, 2003 5:31 AM

If you scroll down 3/4 of this page, you'll notice a section called "Announcements" on this weblog's right hand column. Under that I have a countdown for Apple's grand opening of their Honolulu retail store. I'm using a plugin for... Read More

Cool new plugin by David Raynes... "MTCountdown provides a set of tags that will allow you to place a countdown... Read More

Thanks to this plugin I've been able to remove the last bit of JavaScript from my home page. Thanks David! :) Read More

Thanks to this plugin I've been able to remove the last bit of JavaScript from my home page. Thanks David! :) Read More

MTCountdown from The Realm of Chadness on May 13, 2003 3:40 PM

I just added the MTCountdown plug-in to my installation of MT. Those of you who host your blogs on my Read More

Countdown from Ted's Travel Log on July 13, 2003 6:46 PM

I'm trying to implement a countdown timer so you can see how many days are left, but I seem to get a value of 3 days no matter how many actual days are left. I've already spent all weekend poring... Read More

Stats for TriNetre from TriNetre - The Third Eye on August 26, 2003 11:03 PM

Added some stats for TriNetre. In the main page, just see below the Blogroll section. For the "Uptime" data, I had to hack the MTCountdown plugin. Changed the lines that Read More

MTCountdown from daveynin's thing on September 17, 2003 1:40 AM

I just added the MTCountdown plug-in to my installation of MovableType. Take a look on right side corner inside Blog Stats section. Thanks to David Raynes.... Read More

MTCountdown from daveynin's thing on September 17, 2003 9:42 AM

I just added the MTCountdown plug-in to my installation of MovableType. Take a look on right side corner inside Blog Stats section. Thanks to David Raynes. UPDATE: I hacked into MTCountdown and wrote PHP script make this Countdown to count... Read More

The few people who surf their way here might notice a new block in the side bar, Counting the days. I set it up using the MTCountdown plugin by David Raynes. It's a pretty cool plugin, and easy to use.... Read More

¤³¤ÎBlog¤ÏMovableType¤È¤¤¤¦Í­Ì¾¤Ê¥¹¥¯¥ê¥×¥È¤òÍøÍѤµ¤»¤Æ¤¤¤¿¤À¤¤¤Æ¤¤¤ë¤Î¤À¤¬¡¢¥³¥á¥ó¥ÈÅê¹Æ»þ¤Î¥¨¥é¡¼¤¬¤É¤¦¤·¤Æ¤â²ò¾Ã¤Ç¤­¤Ê¤¯¤Æº¤¤Ã¤Æ¤¤¤¿¡£ ¤½¤³¤Ç¥Í¥Ã¥È¤Ç¸¡º÷¤·¤Æ¤ß¤¿·ë²Ì¡¢°ìÈÖ²ò¤ê¤ä¤¹¤½¤¦¤ÊËܽñ¡ÖMovable Type¤Çº£¤¹¤°¤Ç¤­¤ë¥¦¥§¥Ö¥í¥°ÆþÌç¡×¤ò¹ØÆþ¤¹¤ë¤³¤È¤Ë... Read More

当サイトではRSS Feedプラグインをlinkに使ってYahoo!からニュースを取得しており、定期的にそれを更新する必要がある。また、weblogではカレンダーの部分で今日の日付を異なる色で表示した... Read More

当サイトではRSS Feedプラグインをlinkに使ってYahoo!からニュースを取得しており、定期的にそれを更新する必要がある。また、weblogではカレンダーの部分で今日の日付を異なる色で表示した... Read More

BB's Script, Plugin and Hack Archive as of 3/1/04: Collapse... Read More

ホームページの年齢? from Dasalog 〔多聞強識〕 on March 21, 2004 7:39 AM

David Raynes: MTCountdown 「MTCountdown」と「MTEntry」プラグインを使って,MovableType導入からの経過時間をインデックスに表示します。(この右下にあるやつです)... Read More

特定の日からの日数をカウントする from ????日坊主なウェブログ on March 23, 2004 8:20 AM

プラグインMTCountdownを使って????日坊主なウェブログの日数をカウントする。 やり方はpluginフォルダにcountdown.plをアップロードして、テンプレートの表示したい場所に å¹´ 日 時間 分 ç... Read More

特定の日からの日数をカウントする from ????日坊主なウェブログ on March 23, 2004 8:26 AM

プラグインMTCountdownを使って????日坊主なウェブログの日数をカウントする。 やり方はpluginフォルダにcountdown.plをアップロードして、テンプレートの表示したい場所に <MTCountdown unti... Read More

The big news! from Steamed Puddings on April 8, 2004 9:26 PM

We finally sold our house today! Yay! We also finally reached an agreement on our next house, the one we've wanted all along! Double yay! Now the fun starts - packing. Oh yay (sarcastic). Thanks to David Raynes' MT Countdown... Read More

MTCountdown from 生活像啤酒一樣苦 像巧克力一樣的甜 on July 18, 2004 11:56 AM

以前介紹過Java的倒数†数器,今天看到了一個MT的plugin型†数器MTCountdown,這個不單單的可以計數,年,星期等都可表示出來(見我的主頁的右上面),很好很好。... Read More

MTCountdown from 生活像啤酒一樣苦 像巧克力一樣的甜 on August 21, 2004 5:59 AM

以前介紹過Java的倒数计数器,今天看到了一個MT的plugin型计数器MTCountdown,這個不單單的可以計數,年,星期等都可表示出來(見我的主頁的右上面),很好很好。... Read More

In the vein of giving credit where credit is due, I give you the Acknowledgements Post. I'll begin by thanking Six Apart for developing the MovableType software and for offering a free version of it. I would also like to... Read More

There have been a lot of changes here recently, most of them on the back-end. Most of this work was related to having a bilingual (English and Urdu) blog along with MathML equations. This required valid XHTML 1.1 and serving... Read More

Thanks to the Countdown plugin for Movabletype this blog now features an uptime statistic on the sidebar.... Read More

私が幹事を務める同窓会のブログにカウントダウンを設置しました。まずプラグインをカ... Read More

私が幹事を務める同窓会のブログにカウントダウンを設置しました。まずプラグインをカ... Read More

最近"MTcountdown”を検索キーにしてアクセスしてくる方が増えました。M... Read More

29 Comments

I could've used this one a few months ago... ;-)

This is a great plugin. Can one be created for a countup? Like if I wanted to have a count of how old my son is, day by day? Or is that just too geeky? =)

I used it on my homepage but doesn't seem to work!?! I put in "2003-12-24 17:00:00" for the date and it come back with nothing!

What did I do wrong?

I used it on my homepage but doesn't seem to work!?! I put in "2003-12-24 17:00:00" for the date and it come back with nothing!

What did I do wrong?

Very cool -- thanks. But I think I'm missing something. The countdown appears to work in that it comes up with a number of days, hours, etc. However, the numbers are all wrong. On June 25th I entered , but it says that's only 3 days away. The only thing I can figure is it gets its time from the server, and the server clock is wrong. But if that's the case, why would my blog entries be dated correctly? Any clues? Thanks!!

Very cool -- thanks. But I think I'm missing something. The countdown appears to work in that it comes up with a number of days, hours, etc. However, the numbers are all wrong. On June 25th I entered , but it says that's only 3 days away. The only thing I can figure is it gets its time from the server, and the server clock is wrong. But if that's the case, why would my blog entries be dated correctly? Any clues? Thanks!!

Very cool -- thanks. But I think I'm missing something. The countdown appears to work in that it comes up with a number of days, hours, etc. However, the numbers are all wrong. On June 25th I entered , but it says that's only 3 days away. The only thing I can figure is it gets its time from the server, and the server clock is wrong. But if that's the case, why would my blog entries be dated correctly? Any clues? Thanks!!

oops. really sorry about the multiple comments. :-|

I am having trouble implementing this plugin, no doubt due to user error. I put countdown.pl in the plugins directory, logged in to MT, then inserted your sample code from above (I copied and pasted to be sure) into a free area in my main index template. When I try to rebuild, I get the following error:

Build error in template 'Main Index': Error in tag: '' does not match

This text is below the close button:

MT::App::CMS=HASH(0x835f588) Use of uninitialized value in substitution (s///) at plugins/countdown.pl line 85.
MT::App::CMS=HASH(0x835f588) Use of uninitialized value in pattern match (m//) at plugins/countdown.pl line 92.
MT::App::CMS=HASH(0x835f588) Use of uninitialized value in concatenation (.) or string at plugins/countdown.pl line 96.

It appears that MTCountdown is not getting the until value correctly, but I'm running out of ideas on how to fix it. Can you show me the error of my ways?

Ok, right after I hit send I saw the comment about replacing until with date. Problem solved!

Thanks for the plugin!

I have this on my blog to show how long it has been up, but the timing is totally off. My code:


This blog has been up for
years,
days,
hours, and
minutes.


The results are 2 days. It looks like it resets the days every week or something.

This should work better
<MTCountup date="2003-08-29 10:00:00">
This blog has been up for
<MTCountupIfYears><MTCountupYears> years, </MTCountupIfYears>
<MTCountupIfDays><MTCountupDays> days, </MTCountupIfDays>
<MTCountupIfHours><MTCountupHours> hours, and </MTCountupIfHours>
<MTCountupIfMinutes><MTCountupMinutes> minutes. </MTCountupIfMinutes>
</MTCountup>

The times are all wrong.
Its showing 1 year 2 days, 6 hours 25 minutes

It should be 1 years 240something days 8 hours, etc etc

Oh, and what about a Countup/downIfMonths tag?

I'b getting a build error when trying to implement this plugin in my page design. Any help would be greatly appreciated. The sooner, the better!

Build error in template 'Main Index': Error in tag: '' does not match

MT::App::CMS=HASH(0x8360eb0) Use of uninitialized value in substitution (s///) at plugins/countdown.pl line 87.
MT::App::CMS=HASH(0x8360eb0) Use of uninitialized value in pattern match (m//) at plugins/countdown.pl line 94.
MT::App::CMS=HASH(0x8360eb0) Use of uninitialized value in concatenation (.) or string at plugins/countdown.pl line 98.

Great plug-in!

A month tag would be awesome for a future release.

If you could set it up so that after the last day pases it'd display "Tomorrow" instead of nothing that'd be sweet.

would it be possible for this to calculate years, MONTHS and days instead of years, WEEKS and days? just curious. very nice plugin.

My First installed plug-in and it worked great. Thank you.

This is the first plug-in I installed and I am very happy with it.

Thank you

Sean

This is the first plug-in I installed and I am very happy with it.

Thank you

Sean

I have entered the code as shown on comment entry #20 above. I changed to the correct date of Oct 12 2003, but it will only show 2-3 days vice approx 100 days.


This blog has been up for
years,
days,
hours, and
minutes.


Any suggestions?
hanx Marc

where is the MTCountupIfHours?

I set this up with a date of 2004-05-13 14:00:00
and got 3 days, 1 hours, 38 minutes, until my birthday.


So im a little lost. For those of you who got the error messages mentioned in post 26 above make sure you remove the word UNTIL - it should be

I set this up with a date of 2004-05-13 14:00:00
and got 3 days, 1 hours, 38 minutes, until my birthday.


So im a little lost. For those of you who got the error messages mentioned in post 26 above make sure you remove the word UNTIL - it should be

Is there a way to just count the number of weeks? I don't want the # of years.. but the weeks are showing the number relative the years.. I have something that's more than 1 year, but it's showing something less than 52 weeks. Any ideas?

I have never installed plugins but went and put the plug in into my plug in directory and all, but it won't work..weird...

How can I dislpay the countdown time in days only? If the date entered is 1 year from today, I want to see "365 days" rather than "1 year". I'm a newbie to MT and this is my first plugin, so apologies if this is a basic question.

Does this plugin work with MT 3.2? I have tried and been unable to get it to work.

Leave a comment

Recent Entries

  • Plugin Writing 101

    So, I’m planning on writing up some entries about various aspects of plugin development. While I have a couple topics already in mind, I thought...

  • The Olympics Make Me Want To Compete Again

    Every time the Olympics come around (most the summer ones) I always start to delude myself into thinking I could complete once again in the...

  • Minimalist plugins are fun!

    Last night I whipped up one of the smallest plugins I’ve ever written. It is so small in fact that I was able to stuff...

  • Feedburner Widget on MT News

    Movable Type News A WordPress 2.5 Upgrade Guide: And of course there are lots of third-party plugins for the MT dashboard, to integrate statistics and...

  • AD&D Monster Stats for the Presidential Canditates

    Charles Stross (scifi author, D&D nerd, and former perl columnist) posted Politics as she is Played with 3d6: The recent death of Gary Gygax, who...

Close