We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46935
    • 2 Posts
    Hi,

    I have created two TVs for an event namely fromdate and todate.

    I am calling them as
    [+fromdate+]
    [+todate+]
    and they are displaying full time as 08-06-2014 14:28:00.

    I just want the output as '8 June 2014'. All over the internet, everyone is either talking about MODx Revo, or [*pubdate] which nowhere solves the problem for a event or exhibition page.

    Please help!
    • [+phx:input=`[+fromdate+]-[+todate+]`:daterange=`%d.|%m.|%Y`+]

      https://github.com/Jako/PHx-Modifier/blob/master/daterange.phx.php

      fromdate and todate TVs have to use the unixtime widget or the strtotime modifier.

      This would work inside of Ditto if the modifier is found. Outside of Ditto only with the PHx Plugin.
        • 13226
        • 953 Posts
        Have you tried using the DateTime snippet ?

        You can find it here: http://modx.com/extras/package/datetime

        Very easy to use and doesn't need PHX or Ditto

        DateTime example:

        [[DateTime? &format=`%d %B %Y` ×tamp=`[*fromdate*]`]]

        If you are calling them in Ditto (which by the looks of it you are) add the following to your ditto call:

        &dateFormat=`%d %B %Y`

        e.g.

        [[Ditto? &orderBy=`` &tpl=`` &parents=`` &dateSource=`fromdate` &dateFormat=`%d %B %Y`]]


        UPDATE:

        If you are using a Template variable for the date make sure it's set correctly - then your worries are gone.

        I just tested this myself - if you are using Ditto and the TV is set-up correctly, you don't need to add the dateformat code. (you do need it for pub_date etc.)

        You can output the Date TV solely using the standard TV call e.g. [*mydatetv*], so you don't need PHX or DateTime or Ditto to output the TV correctly.

        Take a look at the attached image for the correct set-up for a Date TV. [ed. note: iusemodx last edited this post 10 years, 1 month ago.]
          • 46935
          • 2 Posts
          Quote from: iusemodx at Mar 22, 2014, 01:17 AM
          Have you tried using the DateTime snippet ?

          If you are using a Template variable for the date make sure it's set correctly - then your worries are gone.

          I just tested this myself - if you are using Ditto and the TV is set-up correctly, you don't need to add the dateformat code. (you do need it for pub_date etc.)

          You can output the Date TV solely using the standard TV call e.g. [*mydatetv*], so you don't need PHX or DateTime or Ditto to output the TV correctly.

          Take a look at the attached image for the correct set-up for a Date TV.

          That was pure gold man! Thank you so much for helping me out here. smiley