0

I've looked all over for this and can't seem to find anything for this. I've also found an unresolved similar question about this in stack exchange from many months ago that wasn't answered, so I thought I'd put this forward again:

Is there a simple date picker that will work as a Grid field that will output ONLY the date without the time? All I need is Month, Day, and Year in any order so I can use the search: option in the Grid loop without having to use the "format" parameter.

I know there is a way to build a fieldtype to do this, but I'm not this advanced (yet) with PHP (still learning on Lynda).

I would HIGHLY appreciate any help!

2 Answers 2

0

As far as I know there is no Grid-compatible date fieldtype which stores the date in anything other than a UNIX timestamp (as the native Date fieldtype does). Your best bet is to convert the values you want to search for into GMT UNIX timestamps and then search your Grid with those.

1
  • I was thinking of doing this, but I need to search the grid field for a specific day, not a specific time (including hour, minutes, and seconds). So for example: if the {grid date} is equal to the particular {event date}, then display all grid information for that particular row. Using the unix time stamp prevents me from doing any date matching because the hours, minutes, and seconds never add up. I have tried storing this in stash, but this seems like a SEVERE hack and doesn't seem to work smoothly. I'm hoping there are other ideas out there or maybe a dev who can create this fieldtype? Commented Dec 31, 2014 at 19:57
0

Thanks to Werner from the EllisLab Community Boards for this one:

I was able to use the field type from Event Helper to achieve the solution that I was looking for:

{grid search:dateinfo="<?php echo strtotime('1/2/15'); ?>"}
        <b>date2: {grid:title}<br />
        <b>dateinfo: {grid:dateinfo}<br /><br />
    {/grid}

The actual Event Helper extension still needs to be updated for the new EE version (I'm running 2.9.2) or it will create PHP errors, so I recommend installing only the field type.

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.