Reputation: 41
I am trying to build a timetable that has timezones and so I know when i run $date by a var dump it will convert the time for me but when I try to echo it nothing happens I was wondering if there is a way to echo this change and where I add thing so the timetable works by weeks no dates as its reset at the end of each week, So I want to be able to input lets say monday 10am and have it changed per timezone.
$time = 23;
$date = new \DateTime("{$time}:00:00.000", new DateTimeZone('UTC') );
$timezone = new DateTimeZone('Australia/Melbourne'); $date->setTimezone($timezone);
echo $date;
Upvotes: 1
Views: 55
Reputation: 72269
It's because $date
is a DateTime Object
, so you cannot directly echo
it
check here:-
(if you check the printed output it clearly states DateTime Object
)
BTW you can echo
this object elements in below way:-
Upvotes: 1