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

// 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 > 1000

class 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_FILE
static 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;
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值