I've been asked to have a specific template, contest form, expire at 5:30pm tonite. There are no channel entries on this page so I can't set an entry to expire. Is it possible to do this with conditionals and current time? There are no concerns about time zones as the contest is very localized to one city.

Basically I need to replace the contest form with a short message and it needs to happen at a specific time which I am unable to be in front of a computer.

2 Answers 2


Maybe something like this would work?

{if '{current_time format="%U"}' > '1354296600'}{redirect='somewhere/else'}{/if}

Generate the timestamp using something like http://www.onlineconversion.com/unix_time.htm

  • Thanks James, this was perfect. Tested on a dummy template and works as expected. Set up the live template now. You d'man.
    – CreateSean
    Nov 30, 2012 at 16:14
  • 3
    One note: {if current_time > "1354296600"} should work as well (lacking a format parameter, {current_time} returns a timestamp). Nov 30, 2012 at 17:30
  • As human, i like a human readable format, so that you can actually compare and read something in a humane notation like 2012-12-01 03:30
    – GDmac
    Dec 1, 2012 at 12:01

You should be able to do this with current_time

{if "{current_time format='%Y%m%d'}" ==  "20121130"}

show this


You'll just need to update the format to include the hour/minute as well.

  • For this to work reliably, I think you will need to use unix time as in the answer by @James:{current_time format="%U"}. And instead of == use >=
    – Alex Kendrick
    Nov 30, 2012 at 15:43
  • perhaps. I used it on one of my sites without any issue.
    – Mel
    Nov 30, 2012 at 15:52
  • I'm sure it works great to check "if today == date" but wouldn't quite work for the original question which needs a conditional that is true for all dates after a specific time.
    – Alex Kendrick
    Nov 30, 2012 at 15:55
  • yes I didn't amend it to be the exact solution to John's question, as I felt he would be able to adjust it with what he specifically needed. My conditional isn't exactly like this either. It checks for today's date and other days.
    – Mel
    Nov 30, 2012 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.