Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date in grid #612

Closed
imonteiro opened this issue Jan 18, 2013 · 9 comments
Closed

Date in grid #612

imonteiro opened this issue Jan 18, 2013 · 9 comments

Comments

@imonteiro
Copy link
Member

Original author: tho...@valepizza.com (May 21, 2010 15:21:31)

The date in grid are showing like timestamp.
When i use date in another format like pt_BR, the filter dont work

ZF 1.1
Rev: 1181

Original issue: http://code.google.com/p/zfdatagrid/issues/detail?id=289

@imonteiro
Copy link
Member Author

From bento.vi...@gmail.com on May 21, 2010 15:45:09
Hi,

Format your date like this:

$grid->updateColumn('date',array('format'=>array('date',array('date_format'=>"d-MM-Y"))));

Check this page for more available formats:
http://framework.zend.com/manual/en/zend.date.constants.html#zend.date.constants.phpformats

About date filter: Do you get any errors? This live example is working:
http://zfdatagrid.com/grid/site/crud with this input: 11/11/2010

Best Regards,
Bento Vilas Boas

@imonteiro
Copy link
Member Author

From tho...@valepizza.com on May 21, 2010 15:53:29
the date filter don't get errors, just don't retrieve the correspondent data

@imonteiro
Copy link
Member Author

From tho...@valepizza.com on May 21, 2010 15:58:20
returns "No records found" on filter for a especific date, with exist in database

@imonteiro
Copy link
Member Author

From tho...@valepizza.com on May 21, 2010 16:02:33
thats ok in these format 18-05-2010 (d-MM-Y)
but in these 18/05/2010 (d/MM/Y) not working

@imonteiro
Copy link
Member Author

From bento.vi...@gmail.com on May 21, 2010 16:05:10
Hi,

Paste this code after calling $grid->deploy() and mail me the result if you don't
want to post it here (geral[symbol]petala-azul.com)

echo $grid->getSource()->getSelectObject();die();

Best Regards,
Bento Vilas Boas

@imonteiro
Copy link
Member Author

From tho...@valepizza.com on May 21, 2010 17:43:04
when i edit the register, the date format in the form take another format
look at image:

@imonteiro
Copy link
Member Author

From bento.vi...@gmail.com on May 21, 2010 18:43:20
Hi,

It's the DB format.

You need to do something like this:

$date = $grid->getForm()->getElement()->getValue();
$date = date('d/m/Y',strtotime($date));
$grid->getForm()->getElement()->setValue($date);

Best Regards,
Bento Vilas Boas

@imonteiro
Copy link
Member Author

From tho...@valepizza.com on May 21, 2010 19:09:10
this method $grid->getForm()->getElement()->setValue() works only on insert.
on edit no have effect.

@imonteiro
Copy link
Member Author

From bento.vi...@gmail.com on May 23, 2010 18:19:40
Hi,

About comment #10.

Fixed.

Best Regards,
Bento Vilas Boas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant