We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4971
    • 964 Posts
    I am using EasyEvents as my calendar for scheduling some games.

    I am using two TVs, one for start date and time and one for end
    date and time (need this ability for multi-day events), so I use
    the Date Formatter widget to diplay the info. All this is working
    fine.

    I am also having Ditto display a list of the games with each game
    info in several columns and two are data and time of each game.

    So I need to separate the time and the date and display them in
    the two columns.

    How can I do it?

    I tried using two snippets to do it:
    <?php
    $geStart = [+geDate+];
    $geStartDate = substr_replace($geStart['geDate'],'',-14,-1);
    return $geStartDate;
    ?>
    


    but the parser doesnot like it...

    I also tried this:

    
    <?php
    $geStart = $modx->getTemplateVarOutput(array('geDate','',1));
    var_dump($geStart);
    $geStartDate = substr_replace($geStart['geDate'],'',-14,-1);
    
    return $geStartDate;
    ?>
    


    But I do not get a result from line 1 because it is lackin a docid,
    which I do not know because it is inside Ditto.



    HELP!!!
      Website: www.mercologia.com
      MODX Revo Tutorials:  www.modxperience.com

      MODX Professional Partner
      • 3749
      • 24,544 Posts
      How about PHX:

      <td>[+geDate:dateformat=`%d-%b-%y`+]</td>
      <td>[+geDate:dateformat=`%H:%M`+]</td>
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 4971
        • 964 Posts
        I already tried that Bob, but...

        <td>[+geDate:date=`%d-%b-%y`+]</td>
        <td>[+geDate:date=`%H:%M %p`+]</td>
        


        EasyEvents needs the date formatted in the widget manner
        and Ditto + PHx need the date in unixtime to work...

        so I got Jan 1 1970 for the date and 00:00 AM for the time...
          Website: www.mercologia.com
          MODX Revo Tutorials:  www.modxperience.com

          MODX Professional Partner
          • 3749
          • 24,544 Posts
          Quote from: charliez at Feb 23, 2010, 09:32 PM

          I already tried that Bob, but...

          <td>[+geDate:strtotime:date=`%d-%b-%y`+]</td>
          <td>[+geDate:strtotime:date=`%H:%M %p`+]</td>
          


          This works in Revolution. I’m not sure the code is there in Evolution. If not, you should be able to add a strtotime snippet to use as a custom PHX modifier:

          <?php
          return strtotime($output);
          ?>
          

            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 4971
            • 964 Posts
            Bob, that did it... thanks a million as usual...
              Website: www.mercologia.com
              MODX Revo Tutorials:  www.modxperience.com

              MODX Professional Partner
              • 3749
              • 24,544 Posts
              Quote from: charliez at Feb 24, 2010, 10:14 AM

              Bob, that did it... thanks a million as usual...

              I’m glad it worked. I wasn’t sure it would. smiley
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting