c++ 获取当前时间周初凌晨时间戳(获取当前时间周日凌晨时间戳)

#include<windows.h>
#include <time.h>

int GetWeekBegin(UINT iTmpStamp, UINT& iStamp)
{
  time_t tick = static_cast<time_t>(iTmpStamp);
  struct tm t_tm;
  localtime_s(&t_tm, &tick);
  t_tm.tm_hour = 0;
  t_tm.tm_min = 0;
  t_tm.tm_sec = 0;
  iStamp = static_cast<UINT>(mktime(&t_tm)) - t_tm.tm_wday * 24 * 60 * 60;
  return TRUE;
}

posted @ 2020-10-24 21:54  龙马8586  阅读(422)  评论(0编辑  收藏  举报