What the best line of code for getting the current date time for user preferred time zone?
What the best line of code for getting the current date time for user preferred time zone?
I guess both will return same output.
Have you check that?
Thanks
Girish S.
is that different from this..
DateTimeUtil::newDateTime(DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()),
DateTimeUtil::getTimeNow(DateTimeUtil::getUserPreferredTimeZone()));
DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::getSystemDateTime(), DateTimeUtil::getUserPreferredTimeZone()))
[/quote]You can apply any time zone using applyTimeZoneOffset method
nice, but need the time zone applied
Hi brianmaric,
In addition to the Nuno Maia, You can also make use of "utcNow"method in "DateTimeUtil" class.
Thanks,
Girish S.
DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::getSystemDateTime(), DateTimeUtil::getUserPreferredTimeZone()))
That's date not datetime
Try this
DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()))
André Arnaud de Cal... 291,431 Super User 2024 Season 2
Martin Dráb 230,503 Most Valuable Professional
nmaenpaa 101,156