商店管理系统源代码(四)

来源:互联网 发布:通达信引用60分钟数据 编辑:程序博客网 时间:2024/04/30 19:01
// MyTime.h: interface for the CMyTime class.////////////////////////////////////////////////////////////////////////#if !defined(AFX_MYTIME_H__9B47C165_ED21_464C_92C3_4184CEBF2766__INCLUDED_)#define AFX_MYTIME_H__9B47C165_ED21_464C_92C3_4184CEBF2766__INCLUDED_#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000class CMyTime  {public:CMyTime();virtual ~CMyTime();CTime time;CString GetAllString(BOOL bChinese);CString GetDateString(BOOL bChinese);CString GetTimeString(BOOL bChinese);CString GetSimpleString();CString GetWeekDay();void SetAllString(CString strTime, BOOL bSimple);void SetNow();};#endif // !defined(AFX_MYTIME_H__9B47C165_ED21_464C_92C3_4184CEBF2766__INCLUDED_)// MyTime.cpp: implementation of the CMyTime class.////////////////////////////////////////////////////////////////////////#include "stdafx.h"//#include "SalesManagementSystem.h"#include "MyTime.h"#ifdef _DEBUG#undef THIS_FILEstatic char THIS_FILE[]=__FILE__;#define new DEBUG_NEW#endif//////////////////////////////////////////////////////////////////////// Construction/Destruction//////////////////////////////////////////////////////////////////////CMyTime::CMyTime(){time = CTime::GetCurrentTime();}CMyTime::~CMyTime(){}/************************************************************************函数名:  GetAllString作  者: 谭友亮(Charles Tan)日  期: 2013-3-22作  用:  返回字符串形式的日期时间 形参数:  bChinese:TRUE-"年月日时分秒"  FALSE-"-:"返回值:  修改记录:                                             ************************************************************************/CString CMyTime::GetAllString(BOOL bChinese){CString strTime;if (bChinese){strTime = time.Format("%Y年%m月%d日 %H时%M分%S秒");}else{strTime = time.Format("%Y-%m-%d %H:%M:%S");}return strTime;}/************************************************************************函数名:  GetDateString作  者: 谭友亮(Charles Tan)日  期: 2013-3-22作  用:  返回字符串形式的日期 形参数:  bChinese:TRUE-"年月日"  FALSE-"-:"返回值:  修改记录:                                             ************************************************************************/CString CMyTime::GetDateString(BOOL bChinese){CString strTime;if (bChinese){strTime = time.Format("%Y年%m月%d日");}else{strTime = time.Format("%Y-%m-%d");}return strTime;}/************************************************************************函数名:  GetTimeString作  者: 谭友亮(Charles Tan)日  期: 2013-3-22作  用:  返回字符串形式的时间 形参数:  bChinese:TRUE-"年月日时分秒"  FALSE-"-:"返回值:  修改记录:                                             ************************************************************************/CString CMyTime::GetTimeString(BOOL bChinese){CString strTime;if (bChinese){strTime = time.Format("%H时%M分%S秒");}else{strTime = time.Format("%H:%M:%S");}return strTime;}/************************************************************************函数名:  GetSimpleString作  者: 谭友亮(Charles Tan)日  期: 2013-3-22作  用:  返回简单字符串形式的日期时间 形参数:  返回值:  修改记录:                                             ************************************************************************/CString CMyTime::GetSimpleString(){CString strTime = time.Format("%Y%m%d%H%M%S");return strTime;}/************************************************************************函数名:  GetWeekDay作  者: 谭友亮(Charles Tan)日  期: 2013-3-22作  用:  返回星期 形参数:  返回值:  修改记录:                                             ************************************************************************/CString CMyTime::GetWeekDay(){CString strWeekDay;CString strWeek[7] = {"日","一","二","三","四","五","六"};strWeekDay = "星期" + strWeek[time.GetDayOfWeek() - 1];return strWeekDay;}

原创粉丝点击