⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 otime.h

📁 联通接收发送新程序
💻 H
字号:
/* Copyright(C) 2000 by JiangSu Bell Software CO.,LTD. */
/*
****************************************************************************
Content:        defination of class OTime
Name:           otime.h 		        Version: 1.0.0
Created by:     CaoGuiRong       		Date: 2000-08-23
Comment:

All rights reserved
****************************************************************************
*/


#ifndef __O_TIME__
#define __O_TIME__

#include"otimespan.h"

/*
****************************************************************************
class:          OTime
Name:           otime.h  		        Version: 1.0.0
Created by:     CaoGuiRong       		Date: 2000-08-23
Comment: 时间计算类
****************************************************************************
*/
class OTime
{
public:
  OTime();
  OTime(  const char* pcdate,const char* pctime = NULL );
  OTime(  OTime& otime );
  ~OTime();

  short SetDateTime( const char *pcdate,const char* pctime = NULL );
                          //设置日期时间

  long AbsDay( ) ;        //计算绝对天数
  long AbsSecond(  );     //计算绝对秒数

  void AbsToDate( long iAbs );    //绝对天数转换成日期
  void AbsToTime( long iAbs );    //绝对秒数转换成时间

  OTime&       operator = (  OTime& otime );
  OTime        operator + (  OTimeSpan  otimespan ) ;
  OTime        operator - (  OTimeSpan  otimespan ) ;
  OTimeSpan friend  operator - (  OTime otime1,OTime otime2 ) ;


  OTime& operator += (  OTimeSpan otimespan );
  OTime& operator -= (  OTimeSpan otimespan );


  short operator ==(  OTime otime ) ;
  short operator !=(  OTime otime ) ;
  short operator < (  OTime otime ) ;
  short operator > (  OTime otime ) ;
  short operator <=(  OTime otime ) ;
  short operator >=(  OTime otime ) ;

  short GetYear( ) ;       //返回年份,  如1,100,1986,2000,等
  short GetMonth( ) ;      //返回月份,  如1,2,...12
  short GetDay( ) ;        //返回天数,   如1,2,...31
  short GetDayofWeek( ) ;  //返回星期几,0/sunday,1/monday.....6/saturday
  char* GetTime();         //返回日期串,如'20000101'
  char* GetDate();         //返回时间串,如'021233'
  short GetHour( ) ;       //返回小时数,如,0,1,2,...,23
  short GetMinute( ) ;     //返回分钟数,如,0,1,2,...,59
  short GetSecond( ) ;     //返回秒数,   如,0,1,2,...,59
  char* GetFormatedDate(); //返回格式化日期串,如'2000-01-01'
  char* GetFormatedTime(); //返回格式化时间串,如'02:12:33'

  short AddMonth(   short months ) ;   //加上多少月,成功返回1,否则返回0
  short MinusMonth( short months ) ; //减去多少月,成功返回1,否则返回0
  short AddYear(    short year ) ;    //加上多少年,成功返回1,否则返回0
  short MinusYear(  short year ) ;  //减去多少年,成功返回1,否则返回0
  short AddDay(    short day ) ;    //加上多少天,成功返回1,否则返回0
  short MinusDay(  short day ) ;  //减去多少天,成功返回1,否则返回0



  void  GetLocalTime();             //取本机时间
  void  GetSystemTime();            //取缺省数据库时间

private:
  char  date[ 9 ],fmtdate[ 11 ];
  char  time[ 7 ],fmttime[ 9  ];

};
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -