I am trying to build a simple calendar how can I access the day's date
TomClarkson opened this issue · 3 comments
object(CalendR\Period\Week)#567 (4) {
["current":"CalendR\Period\Week":private]=>
NULL
["begin":protected]=>
object(DateTime)#566 (3) {
["date"]=>
string(19) "2012-04-02 00:00:00"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
["end":protected]=>
object(DateTime)#587 (3) {
["date"]=>
string(19) "2012-04-09 00:00:00"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
["firstWeekday":protected]=>
int(1)
}
when I go echo $day->begin->date I get Cannot access protected property CalendR\Period\Day::$begin
Hi,
Just use the format($format)
method to display the date in wanted format
$day->format('Y-m-d');
Or use the getters :
var_dump($day->getBegin());
/*
class DateTime#1 (3) {
public $date =>
...
}
*/
Thanks for your help with this. I have been reading the docs for http://yohan.giarel.li/CalendR/events.html but I am still unsure how to integrate it with my Laravel 4 project.
I have a lessons table which I was trying to show as events on a calendar on a monthly basis. My table is as follows.
id teacher_id language_taught_id language_known_id start_date end_date places price created_at updated_at
Here is my attempt at getting it to work http://paste.laravel.com/wwi
Could you please tell me how I make my events compatible with CalendR's
Try to return your events in the provider.