KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

What is the best solution to select month and year only #659

Closed Eugene opened this topic on on Feb 8, 2019 - 2 comments

Eugene commented on Feb 8, 2019

Hi,

I don't need full date selector what can I use to select month and year only?

Regards, Eugene

KoolReport commented on Feb 9, 2019

You give the format like this:

<?php
DateTimePicker::create(array(
    "name"=>"myDateTime",
    "format"=>"MM/YYYY"
));
?>

This will trigger the DateTimeFormat to select year and month only. Of course at server-side you will receive the date time in this format "2019-03-01 00:00:00". But you will easy to get the year and month from the format, for example:

$date = DateTime::createFromFormat("Y-m-d H:i:s", "2019-03-01 00:00:00");
$year = $date->format("Y");
$month = $date->format("m");
Eugene commented on Feb 9, 2019

Thank you! It works as I need!

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
solved

None