//
//  DateUtiles.hpp
//  qlibc++
//
//  Created by 胡涛 on 2017/11/16.
//  Copyright © 2017年 胡涛. All rights reserved.
//

#ifndef DateUtiles_hpp
#define DateUtiles_hpp

#include <stdio.h>
#include <string>
#include <time.h>

#include <jebase/config.h>

#include "NumberUtils.hpp"

class JE_API DateUtils{

public:
    static  std::string  randomNowDateString();

    static  std::string  getNowString();

    static  std::string  getNowStringShort();

    static  std::string  getNowTimeStringShort();

    static  std::string  getNowTimeStringMs();

    static  void markTime(int key);

    static  int getTimeGapFrom(int key);

    static std::string getTimeString();

    static std::string getDateString();

    static time_t makeTime(unsigned short year, unsigned char month = 0, unsigned char day = 0, unsigned char hour = 0, unsigned char min = 0, unsigned char sec = 0);

    static time_t getNowTime();

    static std::string stringOfTime(time_t time);

    static unsigned long getNowTimeMs();

    static unsigned long getNowTimeUs();

    static time_t getNextMorningTime();

    static bool checkDateBefore(const std::string& date);

    static unsigned int secondsToNextMorning();

    //unit:hour/minute/day/month/week
    static unsigned long secondsToNextTimeUnit(const std::string& unit);
};

#endif /* DateUtiles_hpp */
