The toUTC() is not needed in the above line. All that we need is a copy-constructed QDateTime.
Can you please clarify why it would fail? I am using Qt 4.8.4 and mattc's solution works for me. I did not try the OP's self-reply since mattc's solution seems more elegant and reliable.
Bookmarks