/*==================================================================
=  文件名:CDateTime_类定义文件                                       
=  修改日期:2003-11-5                                          
=  作者: shen beide
====================================================================*/

#if !defined(_MYDATETIME_H)
#define _MYDATETIME_H

#include "PubHeader.h"

#include "otstr.h"

#ifdef _DLL_PROJECT
class CLASS_EXPORT CDateTime_
#else
class CDateTime_
#endif
{
public:
	enum
	{
		fmt_1=1,  // YYYY-MM-DD hh:mm:ss
		fmt_2=2,  // MM/DD/YYYY hh:mm:ss
		fmt_3=3,  // jul DD YYYY hh:mm:ss  // ONLY FOR DISPLAY

		fmt_v=8   // format by hex value
		          // BYTE 7 6  5   4    3  2  1 0
				  //      ---- --  --   -  -  ----
				  //      Year mon day  h  m  miliseconds(sec*60+ms)
				  //                          millisec in minute
	};

public:
	bool    m_bValid;
	
	UINT2	m_Year;
	UINT2	m_Month;	// 1-12
	UINT2	m_Day;		// 1-31
	UINT2	m_Hour;
	UINT2	m_Minute;
	UINT2	m_Second;   // second in miniute
	
public:
	CDateTime_();

	bool IsValid();
		
	bool set_dateTime(UINT2 Year,UINT2 Month,UINT2 Day,UINT2 Hour,UINT2 Minute,UINT2 Second);
	bool parser_datetime_str(char* lpstr,int format);

	bool get_string(OTSTR& str,int format);
} ;

class CDateTimeSpan_
{
public:

};

///////////////////////////////////////////////////////////
#ifdef _DLL_PROJECT
class CLASS_EXPORT uDateTime_
#else
class uDateTime_
#endif
{
public:
    bool	bValid;
    
    UINT2   year;
    UINT1   mon;
    UINT1   day;
    UINT1   hour;
    UINT1   minute;
    UINT2   millisecond;
    
public:
    uDateTime_();
   ~uDateTime_();
    
    bool isValid();
    void setValid(bool bValid_);
    
    void set(UINT2 year_,UINT1 mon_,UINT1 day_,UINT1 hour_,UINT1 minute_,UINT2 millisecond_);
};

#endif

