Dynamic Dates Examples

Built-in dates:

  • Yesterday: Tuesday [yesterday]
  • Today: Wednesday [today]
  • Tomorrow: Thursday [tomorrow]
  • Last month: December [last-month]
  • This month: January [this-month]
  • Next month: February [next-month]
  • Last year: 2014 [last-year]
  • This year: 2015 [this-year]
  • Next year: 2016 [next-year]

Note: If you are not using WordPress 3 or higher, you should substitute an underscore for the hyphen in the above shortcodes. For example: This year: 2015 [this_year]

Custom dates (English Mode):

  • Copyright © 2015 Jason Hendriks
    [date format=Y]
  • It’s Wednesday 07:11:58 here and it’s Thursday 01:11:58 in Paris, France
    [date format="l h:i:s"] [date format="l h:i:s" timezone="Europe/Paris"]
  • Our church’s next service is on Jan 31/15
    [date format="M d/Y" time="this Sunday"]
  • In 2013 I was two years younger
    [date format="Y" time="2 years ago"]
  • Next year Christmas is on a Saturday!
    [date format="l" time="december 25th +1 year"]
  • Canadian Thanksgiving is October 11th in 2015 and October 9th in 2016
    [date format="F jS" time="second monday of october"]
    [date format="F jS" time="second monday of october" relative_to="next year"]

Custom dates (International Mode):

  • Copyright © 2015 Jason Hendriks
    [date format=yyyy]
  • Il est jeudi, janvier 29 01:11:58 à Paris, France
    [date format="EEEE HH:mm:ss" timezone="Europe/Paris" language="fr_FR"]
  • Voy a la fiesta el viernes 28 de enero
    [date format="d de MMMM" "time="friday" language="es_CL"]

 

53 thoughts on “Dynamic Dates Examples

  1. Wayne

    Hi Jason, thanks for the plugin. I’m using it to display the currents days date and noticed that it flips to the next day a few hours ahead of midnight. Is there a way to correct that? I set my date in my wp setting but that had no effect.

    Reply
  2. Joel D Hamkins

    I really like your plugin—the easy style of your parameters is frankly beautiful—and altogether it seems to be just what I need.

    But I seem to be having a timezone issue. When I use time=”now” I don’t get my current local time, but rather the GMT time, 5 hours off. I’m not sure which time zone my server is in, and it may very well be in GMT (although I had thought it was in California, since I’m running on DreamHost), but my WordPress timezone setting is for New York. Is your plugin using the server timezone rather than the WordPress-set timezone?

    Reply
    1. jason Post author

      sorry it’s taken so long to get back to you. lots of comments got lost in the spam.

      yes the plugin was using the server timezone. v2 of the plugin supports the WordPress timezone setting, and it will let you override the timzone if you wish per shortcode.

      Reply
  3. Adam

    Hi Jason, can you please let me know if it possible for the plugin to omit specific dates and therefore move to the next available date, when it returns a result?
    Eg. jesterprint.com provides print buying online. I would like to use the plugin to advise the customer what date they can expect to receive their order (different products have different lead-times). However, I want to exclude weekends and public holidays from the date the plugin provides, and move forward to the next avaialble date.
    If a product takes 3 days to print and delivery lands on a Sunday, I’d need to fash up Monday, as the delivery date.
    Is this possible – can a list of dates be excluded from the returned results and therefore move to the next availalble date?
    Thanks in anticipation.
    Adam

    Reply
    1. jason Post author

      Download v2. The plugin now uses the WordPress timezone instead of the server timezone by default. Or you can override the timezone with:

      [date gmt_offset="PST"]

      Reply
  4. Jon Hall

    Hi Jason,

    Thanks very much for the plugin. It’s a great help.

    I’ve got it to work for most of what I need but can’t figure out one of them, if you’d be so kind as to help me?

    I’d like it to show the day of the first Wednesday of this month and next month. So it would return ‘Wednesday 5th September’ and ‘Wednesday 5th October’. Is that possible?

    Thanks,

    Jon

    Reply
    1. jason Post author

      This should do it:

      [date format='l' time="first wednesday of this month']
      [date format='l' time="first wednesday of next month']

      Reply
  5. Brian

    Can you set the date to 3 months from today? or possibly the last day of the month, 3 months from now?

    Think automatically changing expiration date for a coupon.

    Reply
    1. jason Post author

      [date format="F j" time="+3 month"]

      and

      [date format="F j" time="last day of +3 month"]

      Reply
  6. Rob

    Hi Jason, great plugin, but can you please provide a key for what the initials mean, eg J, F, Y etc?

    Also can it include the suffixes of “st” and “th”, eg 21st, 30th?

    Thanks

    Reply
    1. jason Post author

      Download v2. The plugin now uses the WordPress timezone instead of the server timezone by default. Or you can override the timezone with:

      [date gmt_offset="EST"]

      Reply
  7. Pauline

    Thanks for the plugin. It works fine for the most part.

    I added this code to a page in our members area:
    [date format="F jS, Y"]

    It is currently June 24 in my time zone (EDT), and my WordPress account is set to NY time. Earlier today the correct date displayed but now it shows that it’s June 25.

    Seems like it might be a time zone setting issue. For example if my wordpress site is hosted in a different time zone, would this plugin show the host’s time zone rather than the visitor’s time zone?

    Reply
    1. jason Post author

      Download v2. The plugin now uses the WordPress timezone instead of the server timezone by default. Or you can override the timezone with:

      [date gmt_offset="EST"]

      Reply
  8. Neville Goddard Audio

    Hi Jason,

    Many thanks!

    I used this for todays date:

    [today], [date format="F j" time="today"], [this-year]

    Hope that helps anyone searching for the same way to use it

    Carl :-)

    P.S. Hope you don’t mind, I used my keyword as my name for an anchor in this comment.

    Reply
  9. Mike Berry (dynamicmike)

    Jason, this looks like it could be very powerful,
    but so far, I’ve been going round in circles trying to find instructions/settings for this.
    I can’t see it in pages, posts, widgets, settings, plugins etc.
    You could help us massively by giving at least one link for guidance & settings
    Mike

    Reply
    1. jason Post author

      Hi Mike, the only instructions are at the Plugin’s site on WordPress, and here.

      It had no settings page at all in WordPress until v2.

      Reply
  10. Vince

    I am using your dynamic dates plugin and I tried to place the shortcode into a small bar at the top of my site and it is displaying the shortcode instead of the formatted date. The small bar is managed through OptionsTree (my WP theme requires it) and that’s the only thing I can think of that’s preventing it from working. If I place the same problematic shortcode into a regular post or page, it works like a charm.

    Any workaround when trying to add content via OptionsTree?

    -Vince

    Reply
    1. jason Post author

      Vince are you still using OptionsTree? I don’t know what the heck that is but I’m sure we could get it to work.

      Reply
    1. jason Post author

      Timezones are supported in v2. I would imagine it’s this, but it’s untested:

      [date format="j F Y - \hH : \mi" gmt_offset="CET"]

      Reply
  11. Dave Golden

    Hello, I am trying to find a plug in that will calculate years of service. For instance, if someone has been working at a company since March 1, 2010, and today is March 3, 2012, I would like it to read, “Years of Service: 2″ and dynamically change to 3 on March 1, 2013. Is this possible? Thank you.

    Reply
  12. brian r

    hi im trying to set up a shipping time calculator with your plugin so customers can see that a product will ship to there door 10 business days 14 business days ect from the current date. I have [date format="F jS" time="2 weeks" relative_to="today"] but this doesnt work if a product will arrive 1.3 weeks from now as i cant put in a decimal. perhaps is there anyway to exclude saturdays and sundays from the count and then count by days?

    Reply
  13. Kees

    Is it also possible to use this plugin for something like this?

    Hello, my name is Kees and I am [date] years old.

    Reply
  14. Chuck

    Hi,

    First of all, great plugin, thank you!

    Secondly, a question.

    Is it possible to change the font style and background color? I get a grey background when I use this on my sites and the font is different.

    Thanks in advance!
    Chuck

    Reply
    1. jason Post author

      Hi Chuck. The plugin has no styling on it’s own. Whatever style the post/page text has when the plugin is inserted, that’s the style the plugin inherits.

      Reply
  15. Margaret Saizan

    very, very cool plugin. Just what I was looking for. love it that it is so lightweight. Many, many, many thanks!

    Reply
  16. Bob

    Jason,

    I have your plugin on my homepage and love it.

    Unfortunately, it seems to be using some ‘alternative’ time zone to calculate the date.

    The server time, WordPress time and my local computer’s time are all correct, but, as early as 7PM Eastern Standard Time on Saturday, Dynamic Date says it’s the next day, Sunday. My host in Utah (Mountain time – two hours difference from EST) says that on their computers it’s also showing up as tomorrow’s date.

    Can you tell me if the plugin is pre-set to UTC, and if so, where can I change the settings to ensure it is actually pulling the server time. If there’s any code for that, I’d deeply appreciate it.

    I’d hate to replace it with a javascript as I also use it on all my sites and pages/posts to identify the copyright year.

    Thanks for your kind attention to this!

    Reply
    1. jason Post author

      Hi Bob. v2 now uses the WordPress timezone rather than the server timezone.

      But a timezone offset (+/- 24 hours) is a negligible influence on a scale as large as a year.

      Reply
  17. Mike

    Can you explain the date format so I know what code to insert when I want a different date?

    Reply
  18. Fritz

    Awesome man thanks for making this. I used [date format="F j, Y" time="tomorrow"] to display tomorrows date and year with a comma in between e.g. if today is October 19, 2011 it displays “October 20, 2011″

    Reply
  19. Gary Hyman

    1st of all – thanks for the plugin. It seems very useful.

    How do I display the current day? I would like a WP page to display for example 3 October 2011. I understand that the tags [this-month] [this-year] will display October 2011, but is there a tag to display the current day – i.e 3?

    Reply
  20. Pingback: wordpress plugin review and discussion. | Loadwp.com

  21. Elena

    Hello!
    Thanks for the plugin – great idea, really needed!
    I can’t find format for ‘sysdate’.
    I want readers to see current day and date in the format ” Monday, July 18th, 2011 ” or similar.

    Best regards
    Elena

    Reply
  22. Steve @ Plane Simulation Games

    Hi

    I am trying to setup the plugin but not much instructions, can you tell me the shortcode for;

    example 1 – Friday 8th July
    example 2- Friday 8th July 2011

    also is there no settings in wp admin area?

    thanks
    Steve

    Reply
    1. jason Post author

      Try [date format="l F jS"] and [date format="l F jS Y"]

      Nope, no settings in the admin area. Is there something it needs?

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>