title: Qt: How to set a date with time, to a QDateTimeEdit?
body: <p>I'm getting dates formatted like this: "2011-04-14 15:00:00", and want to set them to a QDateTimeEdit object.</p>
  
  <p>This is what i do:</p>
  
  <pre><code>void MainWindow::setUIDateAndTime(QString &amp;date)
  {
      QDateTime dateTime;
      dateTime.fromString(date, "yyyy-MM-dd hh:mm:ss");
  
      QString sDatetime = dateTime.toString("yyyy-MM-dd hh:mm:ss"); // For debug testing
  
      // Create the datetime picker
      QDateTimeEdit *dateTimePicker = new QDateTimeEdit(dateTime);
      dateTimePicker-&gt;setObjectName("dateTimePicker");
  
      ui-&gt;frameCommentHolderLayout-&gt;addWidget(dateTimePicker);
  }
  </code></pre>
  
  <p>But it never get's set.
  The debug variable "sDateTime" is always set to "".</p>
  
  <p>Does Anybody see what i do wrong?
  Thanks in advance.</p>