Results 1 to 3 of 3

Thread: QDateTime from non-standard timestamp

  1. #1
    Join Date
    Jan 2008
    Posts
    107
    Thanks
    36
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QDateTime from non-standard timestamp

    Hi,

    This is probably a lame question... but:

    Given a timestamp that starts from 2007-01-01 00:00:00

    How could one extract the correct date/time from it?

    For "normal" unix timestamps I use:

    Qt Code:
    1. dateTime=QDateTime::fromTime_t ( this->timestamp/1000 );
    2. humanDate = dateTime.toString ( "yyyy-MM-dd hh:mm:ss" );
    To copy to clipboard, switch view to plain text mode 

    Already thankful for any insight,
    Pedro Doria Meunier

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QDateTime from non-standard timestamp

    QDateTime::fromString is your friend.

  3. The following user says thank you to wysota for this useful post:

    pdoria (11th April 2008)

  4. #3
    Join Date
    Jan 2008
    Posts
    107
    Thanks
    36
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QDateTime from non-standard timestamp

    Txs Wysota,

    That's precisely what I've used!

    Kind regards,
    Pedro Doria Meunier.

Similar Threads

  1. QProcess +standard error + windows
    By antonio.r.tome in forum Qt Programming
    Replies: 0
    Last Post: 18th April 2006, 14:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.