Does anyone know how I would use MIGX to store and display the date and time in a custom table with the date input field. When the date input field is specified it automatically adds time with it, but I can't figure out how to use both the date and time together. The MIGX date input can read timestamps, or unix timestamps and it stores the information it gathers in one field in my table. Does anyone know what I need to do to make this work?
you want to have the date and the time in two seperate fields?
why?
you will need custom - processors for fields.php, update.php and if you want so for getlist.php
Instaed of a custom getlist - processor it would be possible to use the renderChunk - renderer to create the date + time - column-output
Thank you for the help Bruno and exside! I wasn't sure how to make the date and time be stored in the same field in my database because I had my data type set to either date or time not datetime. Instead of using a unix timestamp I have set my database data type to datetime which allows me to use both the date and time input fields in the Migx overlay. The date/time also shows up like I would expect them to in the add/edit mode fields.
I believe I was thinking along the same lines as you exsied. I looked at the site_content table and the pub_date and unpub_date were unix timestamps so I was thinking that I needed to use the same for the date inputs to work, but they weren't working with MIGX. Updating the data type to datetime solved my problem.
So with updating my tables to have the date/time field be a datetime data type the MIGX overlay works perfectly. What would I need to do to make it so that the MIGX table gives me a nicer looking date format? Whether I use a chunk, snippet, or modify the getlist.php file are there any tutorials I can follow to accomplish this?
you can use the date-renderer for this column.
It renders the date in the format, as defined in system-settings.
Another way would be to use a chunk-renderer for this column.
Create one renderOption for this renderer and set the name-field in that renderOption to a chunk-name.
In this chunk you can format the output of the column, for example:
[[+yourdatefield:strtottime:date=`%d.%m.%Y %H:%M`]]
Got it!! Thank You for your help Bruno!! Does the renderDate only work with fields with a data type of datetime or can it work with fields that are date or time?
[ed. note: jsteffan1 last edited this post 13 years, 5 months ago.]