zoukankan      html  css  js  c++  java
  • Qt获取当前时间

    1 使用QDateTime类(毫秒精度)

    QDateTime current_date_time = QDateTime::currentDateTime();
    QString current_date = current_date_time.toString("yyyy-MM-dd hh:mm::ss.zzz");

    2 使用QTime类

    QTime current_time = QTime::currentTime();
    int hour = current_time.hour();        //当前的小时
    int minute = current_time.minute();    //当前的分
    int second = current_time.second();    //当前的秒
    int msec = current_time.msec();        //当前的毫秒

     3 使用GetLocalTime函数(毫秒精度)

    SYSTEMTIME sys;
    GetLocalTime(&sys);
    printf("%4d/%2d/%2d %2d:%2d:%2d.%3d
    ",sys.wYear, sys.wMonth, sys.wDay, sys.wHour, sys.wMinute, sys.wSecond, sys.wMilliseconds);
  • 相关阅读:
    Yarn
    easyui
    eclipse-android
    js-小技能 そうですか
    sql server 时间处理
    上传文件
    时间 & 时间戳 之间 转换
    JDIC
    Spring 定时器
    映射
  • 原文地址:https://www.cnblogs.com/LuckCoder/p/11165510.html
Copyright © 2011-2022 走看看