A user object that is operated by its own package

xiaoxiao2021-03-06  55

$ PBEXPORTHEADER $ NVO_DATETIME.SRU

$ PBEXPORTCOMMENTS $ Date Time Operation Class

Forward

Global Type NVO_DATETIME from NonvisualObject

End Type

TYPE STC_SYSTEMTIME from Structure Withnin NVO_DATETIME

End Type

End forward

Type STC_SYSTEMTIME FROM STRUCTURE

INTEger Wyear

Integer WMONTH

Integer WDAYOFWEEK

Integer WDAY

INTEger WHO

Integer Wminute

INTEGER WSECOND

Integer WmilliseConds

End Type

Global Type NVO_DATETIME from NonvisualObject AutoInStantiate

End Type

Type Prototypes

Function long setsystemtime (stc_systemtime lpsystemtime) library "kernel32.dll"

End protoypes

Forward Prototypes

Public function integer of_getdaysinmonth (Date Ad_Date)

Public function date of_getlastdayinmonth (date ad_date)

Public Function Date of_GetlastdayinMonth (Integer Ai_Year, Integer Ai_Month)

Public Function Date of_GetFirstdayinmonth (Date Ad_Date)

Public Function Date of_Getfirstdayinmonth (Integer Ai_Year, Integer Ai_Mont)

Public Function Boolean of_IsLeapyear (Date Ad_Date)

Public function boolean of_isleapyear (Integer ai_year)

Public Function Boolean of_lsweekend (Date Ad_Date)

Public Function Date of_skipholidAys (Date Ad_Date, Integer Ai_Increment)

Public function date of_getnextworkday (dataWindow adw_holidays, string as_columnname, date ad_date)

Public function date of_getpreviousworkday (dataWindow adw_holidays, string as_columnname, Date Ad_Date)

Public Function Date of_GetPreviousWorkday (Date Ad_Date)

Public function date of_getnextworkday (date ad_date)

Public function date of_skipholidays (datastore ads_holidays, string as_columnname, date ad_date, integer ai_increment)

Public function date of_skipholidays (dataWindow adw_holidays, string as_columnname, date ad_date, integer ai_increment)

Public Function Date of_GetnextWorkday (Datastore Ads_holidays, String As_Columnname, Date Ad_Date)

Public Function Date of_GetFirstWorkDay (DataWindow Adw_holidays, String As_Columnname, Date Ad_Date)

Public function date of_getfirstworkday (datastore ads_holidays, string as_columnname, date ad_date)

Public Function Date of_GetpreviousWorkday (Datastore Ads_holidays, String As_Columnname, Date Ad_Date)

Public function date of_getfirstworkday (date ad_date)

Public Function Date of_GetlastWorkDay (Datastore Ads_holidays, String As_Columnname, Date Ad_Date)

Public Function Date of_GetlastWorkday (DataWindow Adw_holidays, String As_Columnname, Date Ad_Date)

Public function Date of_getlastWorkday (Date Ad_Date)

Public function integer of_getdaysinmonth ()

PUBLIC FUNCTION INTEGER OF_COUNTDOWINMONTH (Date Ad_Date, Integer Ai_DOW)

Public function integer of_countdowinmonth (date ad_date)

Public Function Integer of_countWorkDays (DataWindow Adw_holidays, String As_Columnname, Date Ad_StartDate, Date Ad_Enddate)

Public Function Date of_GetfirstdayinWeek (Date Ad_Date)

Public Function Date of_GetlastDayinWeek (Date Ad_Date)

Public function date of_getfirstdayinmonth ()

Public function date of_getlastdayinmonth ()

Public function date of_getfirstworkday ()

Public function date of_getlastworkday ()

Public function Date of_GetfirstdayinWeek ()

Public function Date of_getlastdayinweek ()

Public function date of_getnextworkday ()

Public function date of_getprevious workday ()

Public Function INTEGER OF_COUNTHOLIDAYS (DataWindow Adw_holidays, String As_ColumnName, Date Ad_StartDate, Date Ad_Enddate)

Public function integer of_counendays (date ad_startdate, date ad_enddate)

public function integer of_countholidays (datastore ads_holidays, string as_columnname, date ad_startdate, date ad_enddate) public function integer of_countworkdays (datastore ads_holidays, string as_columnname, date ad_startdate, date ad_enddate)

Public function integer of_countworkDays (date ad_startdate, date ad_enddate)

Public Function Integer of_getage (Date Ad_BritHDay, Date Ad_Date)

Public Function Long of_YearSafter (Date Ad_Start, Date Ad_END)

Public function long of_monthsafter (Date Ad_Start, Date Ad_END)

Public Function Long of_WeekSafter (Date Ad_Start, Date Ad_END)

Public Function Long Of_Secondsafter (DateTime ADTM_Start, DateTime ADTM_END)

PUBLIC FUNCTION Long of_MilliseCsafter (Time ATM_START, TIME ATM_END)

Public Function Date of_RELATIVEMOTH (Date Ad_Source, Integer Al_Month)

Public Function DateTime of_RELATIVEDATETIME (DateTime ADTM_Start, Integer Al_offset)

Public function integer of_getquarter (Date Ad_Source)

Public function integer of_getquarter ()

Public function date of_getfirstdayinquarter (date ad_date)

Public function Date of_Getfirstdayinquarter ()

Public function Date of_getlastdayinquarter (Date Ad_Date)

Public function Date of_getlastdayinquarter ()

Public Function Long of_CountWeeksinyear (Date Ad_Source)

Public Function Integer of_getdayinweek (Date Ad_Source)

Public function date of_getfirstdayinyear (Date Ad_Date)

Public function Date of_Getfirstdayinyear ()

Public function date of_getfirstdayinyear (Integer ai_year)

Public function date of_getlastdayinyear (Date Ad_Date)

Public function Date of_getlastdayiinyear ()

Public function date of_getlastdayinyear (integer ai_year)

Public function integer of_countyearDays (date ad_date)

Public function integer of_countyearDays () public function integer of_countyeardays (Integer ai_year)

Public function string of_getconstellation (Date Ad_Date)

Public function string of_getgenus (Integer ai_year)

Public function string of_convertdayoflunar (date ad_date)

Public Function DateTime of_RELATIVEDATETIME (datetime ad_datetime, long al_number, string as_kind)

Public function string of_gettgdz (Integer ai_year)

Public function string of_gettgdz (Date Ad_Date)

Public function string of_gettgdz ()

Public function boolean of_isLeepyear ()

Public Function String of_GetGenus (Date Ad_Date)

Public function string of_getgenus ()

Public function integer of_countdowinmonth ()

Public Function Integer of_getage (Date Ad_BritHDay)

Public function integer of_countdowinmonth (Integer ai_dow)

Public Function Long of_CountWeeksinyear ()

Public Function Boolean of_setSystemTime (DateTime ADT_DATETIME)

End protoypes

Public Function Integer of_getDaysinmonth (Date Ad_Date); / * Function: Get the number of days in the specified date

Return value: Integer specifies the number of days in the month

Parameters: ad_date date Date * /

Return Integer (28 Integer (MID (Sign (Sign (Sign (Sign (ABS (ABS (ABS (ABS (ABS (ABS (ABS (AD_DATE)), 100 )) Sign (ABS (Year (ABS (Year (AD_DATE)), 400), 2)) - 1)) '3232332323', Month (ad_date), 1)))

END FUNCTION

Public function date of_getlastdayinmonth; / * Function function: Get the last day of the month of the specified date

Return value: Date Specifies the last day of the month

Parameters: ad_date date Date * /

Return Date, Month (ad_date), Integer (28 Integer (MID (Sign (Sign (Sign (Sign (Sign (ABS (ABS (AD_DATE)), 4)) SIGN (Mod (ABS (ABS (AD_DATE)), 100)) SIGN (ABS (ABS (Year (AD_DATE)), 400), 2)) - 1)) '3232332323', Month (ad_date), 1) )))))))

End functionpublic function date of_getlastdayinmonth (Integer ai_year, integer ai_month); / * Function: Get the final day of the month, the last day of the month

Return Value: Date specified year, the last day of the month

Parameters: Integer Ai_Year Year

Integer ai_month month * /

Date ld_date

LD_DATE = DATE (Ai_Year, Ai_Month, 1)

Return Date (Year (LD_DATE), MONTH (LD_DATE), INTEGER (28 Integer (MID (Sign (Sign (Sign (Sign (Sign (ABS (ABS (ABS (ABS (Year (LD_DATE)), 4)) SIGN (MOD (ABS (Year (LD_DATE)), 100)) SIGN (ABS (ABS (Year (LD_DATE)), 400), 2)) - 1)) '3232332323', Month (LD_DATE), 1) )))))))

END FUNCTION

Public Function Date of_GetFirstdayinMont (Date Ad_Date); / * Function: Get the first day of the specified date

Return Value: Date The first day of the month

Parameters: Date Ad_Date Date * /

Return Date (Year (ad_date), Month (ad_date), 1)

END FUNCTION

Public Function Date of_GetFirstdayinMonth (Integer Ai_Year, Integer Ai_Month); / * Function: Get the designated year, the first day of the month

Return value: Date specified year, the first day of the month

Parameters: Integer Ai_Year Year

Integer ai_month month * /

Return Date (ai_year, ai_month, 1)

END FUNCTION

Public Function Boolean Of_IsLeApyear (Date Ad_Date); / * Function: Get whether the year in which the specified date is a leap year

Return Value: Boolean is the year of the date for the year, True is a leap year, False is a year

Parameters: ad_date date Date * /

Integer li_year

Li_Year = year (ad_date)

Return ABS (Sign (MOD (MOD (ABS (ABS (LI_Year), 4)) SIGN (MOD (ABS (LI_Year), 100)) SIGN (MOD (ABS (LI_Year), 400), 2)) 1) = 1

END FUNCTION

Public Function Boolean Of_IsLeApyear; / * Function: Gets whether the designated year is a leap year

Return Value: Boolean is a leap year, True is a leap year, False is a year

Parameters: ai_year integer year * /

Return ABS (Sign (MOD (MOD (ABS (ABS (AI_Year), 4)) SIGN (MOD (ABS (AI_Year), 100)) SIGN (MOD (ABS (AI_Year), 400)), 2) 1) = 1

END FUNCTION

Public Function Boolean Of_LSWeekend (Date Ad_Date); / * Function: Gets whether the specified date is the weekend return value: Date Specify whether the date is weekend

Parameters: ad_date date Date * /

String ls_week

Ls_week = dayname (ad_date)

Choose Case DayName (ad_date)

Case "Saturday", "Sunday"

Return True

Case Else

Return False

End chaoose

END FUNCTION

Public function date of_skipholidays (Date Ad_Date, Integer Ai_INCREMENT); / * Function: Get the next date of the specified date skipping weekend

Return value: Date Returns the specified specified date skipping weekend next date

Parameters: ad_date date Date

AI_INCREMENT INTEGER Specifies the number of skips * /

Date ld_date

LD_DATE = ad_date

Do While of_lsweekend (ld_date) = TRUE

LD_DATE = RelativeDate (ld_date, ai_increment)

loop

Return LD_DATE

END FUNCTION

Public Function Date of_GetnextWorkday (dataWindow Adw_holidays, String As_Columnname, Date Ad_Date); / * Function: Get the next working day of the specified date skipping weekend and holidays

Return Value: Date Returns the specified specified date skipping weekend next working day

Parameters: Adw_holidays DataWindow stores the data window for the holiday

AS_COLUMNNAME STRING Data window storage holiday list

Ad_date Date Date

* /

Return of_skipholidays (adw_holidays, as_columnname, relativedate (ad_date, 1), 1)

END FUNCTION

Public Function Date of_GetPreviousWorkday (dataWindow Adw_holidays, String As_Columnname, Date Ad_Date); / * Function: Get a working day of the designated date skipping weekend and holidays

Return Value: Date Returns the specified specified date skipping the last working day of the weekend

Parameters: Adw_holidays DataWindow stores the data window for the holiday

AS_COLUMNNAME STRING Data window storage holiday list

Ad_date Date Date

* /

Return of_skipholidays (adw_holidays, as_columnname, relativedate (ad_date, -1), - 1)

END FUNCTION

Public Function Date Of_GetPreviousWorkDay; / * Function: Gets the last business day of the designated date skipping weekend

Return Value: Date Returns the specified specified date skipping the last working day of the weekend

Parameters: ad_date date Date * /

Return of_skipholidays (RelativeDate (ad_date, -1), - 1)

END FUNCTION

Public Function Date Of_GetnextWorkDay (Date Ad_Date); / * Functional: Get the next working day of the specified date skipping weekend: Date Returns the next working day of the designated specified date skipping weekend

Parameters: ad_date date Date * /

Return of_skipholidays (RelativeDate (ad_date, 1), 1)

END FUNCTION

Public function date of_skipholidays (DATASTORE ADS_HOLIDAYS, STRING AS_COLUMNNAME, DATE AD_DATE, INTEGER AI_INCREMENT); / * Function: Get the next date of the specified date skipping weekend and holidays

Return Value: Date Returns the next date of the specified specified date skipping weekend and holidays

Parameters: Adw_holidays DataStore stores data storage objects for holidays

AS_COLUMNNAME STRING Data window storage holiday list

Ad_date Date Date

Ai_increment Integer Specifies Skip Day

* /

Date ld_date

LD_DATE = ad_date

Do WHILE OF_LSWEEKEND (LD_DATE) = true or ads_holidays.find ("String (" as_columnname ", 'yyyy-mm-dd')" "= '" string (ld_date, "yyyy-mm-dd") " '", 1, ADS_HOLIDAYS.ROWCOUNT ()) <> 0

LD_DATE = RelativeDate (ld_date, ai_increment)

loop

Return LD_DATE

END FUNCTION

Public function date of_skipholidays (datawindow adw_holidays, string as_columnname, date ad_date, integer ai_increment); / * Function: Get the next date of the specified date skipping weekend and holidays

Return Value: Date Returns the next date of the specified specified date skipping weekend and holidays

Parameters: Adw_holidays DataWindow stores the data window for the holiday

AS_COLUMNNAME STRING Data window storage holiday list

Ad_date Date Date

Ai_increment Integer Specifies Skip Day

* /

Date ld_date

LD_DATE = ad_date

Do WHILE OF_LSWEEKEND (LD_DATE) = true or adw_holidays.find ("String (" as_columnname ", 'yyyy-mm-dd')" "= '" string (ld_date, "YYY-MM-DD") " '", 1, adw_holidays.rowcount ()) <> 0

LD_DATE = RelativeDate (ld_date, ai_increment)

loop

Return LD_DATE

END FUNCTION

Public Function Date of_GetnextWorkDay (DATASTORE ADS_HOLIDAYS, STRING AS_COLUMNNAMES, STRING AS_COLUMNNAME, DATE AD_DATE); / * Function: Get the next working day of the specified date skip weekend and holiday: Date Returns the specified specified date skipping weekend next working day

Parameters: ADS_HOLIDAYS DATASTORE Stores data storage objects for specified holidays

AS_COLUMNNAME STRING Data window storage holiday list

Ad_date Date Date

* /

Return of_skipholidays (ads_holidays, as_columnname, relativedate (ad_date, 1), 1)

END FUNCTION

Public Function Date of_GetFirstWorkDay (DataWindow Adw_holidays, String As_Columnname, Date Ad_Date); / * Function: Get the first working day of the specified date

Return value: Date Returns the first working day of the specified date

Parameters: Adw_holidays DataWindow Stores the data storage objects for the specified holiday

AS_COLUMNNAME STRING Data window storage holiday list

Ad_date Date Date

* /

Date D_Temp

D_Temp = Date (Year (ad_date), Month (ad_date), 1)

Return of_skipholidays (adw_holidays, as_columnname, d_temp, 1)

END FUNCTION

Public Function Date of_GetFirstWorkDay (DATASTORE ADS_HOLIDAYS, STRING AS_COLUMNNAME, DATE AD_DATE); / * Function: Get the first working day of the specified date

Return value: Date Returns the first working day of the specified date

Parameters: ADS_HOLIDAYS DATASTORE Stores data storage objects for specified holidays

AS_COLUMNNAME STRING Data window storage holiday list

Ad_date Date Date

* /

Date D_Temp

D_Temp = Date (Year (ad_date), Month (ad_date), 1)

Return of_skipholidays (ads_holidays, as_columnname, d_temp, 1)

END FUNCTION

Public Function Date of_GetPreviousWorkday (DATASTORE ADS_HOLIDAYS, STRING AS_COLUMNNAME, DATE AD_DATE); / * Function: Get a working day of the specified date skipping weekend and holidays

Return Value: Date Returns the specified specified date skipping the last working day of the weekend

Parameters: ADS_HOLIDAYS DATASTORE Stores data storage objects for specified holidays

AS_COLUMNNAME STRING Data window storage holiday list

Ad_date Date Date

* /

Return of_skipholidays (ADS_HOLIDAYS, AS_COLUMNNAME, RELATIVEDATE (ad_date, -1), - 1)

END FUNCTION

Public Function Date Of_GetFirstWorkDay (Date Ad_Date); / * Function: Get the first working day of the specified date

Return value: Date Returns the first working day of the specified date

Parameters: ad_date date Date * /

Date D_Temp

D_Temp = Date (Year (ad_date), Month (ad_date), 1) Return of_skipholidays (D_Temp, 1)

END FUNCTION

Public Function Date of_GetlastWorkDay (String as_Columnname, Date Ad_Date); / * Function: Get the last business day of the specified date

Return value: Date Returns the last working day of the specified date

Parameters: ADS_HOLIDAYS DATASTORE Stores data storage objects for specified holidays

AS_COLUMNNAME STRING Data window storage holiday list

Ad_date Date Date

* /

Date D_Temp

D_Temp = of_getlastdayinmonth (ad_date)

Return of_skipholidays (ADS_HOLIDAYS, AS_COLUMNAME, D_TEMP, -1)

END FUNCTION

Public Function Date of_GetlastWorkDay (dataWindow Adw_holidays, String As_Columnname, Date Ad_Date); / * Function: Get the last working day of the specified date

Return value: Date Returns the last working day of the specified date

Parameters: Adw_holidays DataWindow stores the data window for the holiday

AS_COLUMNNAME STRING Data window storage holiday list

Ad_date Date Date

* /

Date D_Temp

D_Temp = of_getlastdayinmonth (ad_date)

Return of_skipholidays (adw_holidays, as_columnname, d_temp, -1)

END FUNCTION

Public Function Date of_getlastWorkDay (Date Ad_Date); / * Function: Get the last working day of the specified date

Return value: Date Returns the last working day of the specified date

Parameters: ad_date date Date * /

Date D_Temp

D_Temp = of_getlastdayinmonth (ad_date)

Return of_skipholidays (D_Temp, -1)

END FUNCTION

Public Function Integer of_getDaysinMonth (); / * Function: Get the number of days in the specified date

Return value: Integer specifies the number of days in the month

Parameters: ad_date date Date * /

Return INTEGER (28 Integer (MID ('3' string (ABS (Sign (SIGN (Sign (ABS (ABS (ABS ("())), 4)) SIGN (MOD (ABS (" )), 100)) SIGN (ABS ("DAY ())), 400)

END FUNCTION

Public Function Integer of_CountDowinMonth (Date Ad_Date, Integer Ai_DOW); / * Function: Get the number of days of the designated day of the month of the specified date

Return Value: Integer Specifies the Number of Days

Parameters: ad_date date Date

Ai_DOW Integer specified by the week 1 represents Sunday ... 7 represents Saturday * / Date D_First

Integer Intcount, Intmonth

IF (AI_DOW <1 or Ai_DOW> 7) THEN

AI_DOW = dayNumber (ad_date)

END IF

INTMONTH = MONTH (ad_date)

D_First = Date (Year (ad_date), Month (ad_date), 1)

Do While DayNumber (D_First) <> ai_dow

D_first = relativedate (D_First, 1)

loop

INTCOUNT = 0

Do While Month (D_First) = IntMonth

INTCOUNT = INTCOUNT 1

D_first = relativedate (D_First, 7)

loop

Return Intcount

END FUNCTION

Public Function Integer Of_CountDowinMonth; / * Function: Gets Monday, which is the month of the specified date

Return Value: Integer Specifies the number of days of the day of the month

Parameters: ad_date date Date * /

Return of_countdowinmonth (ad_date, 2)

END FUNCTION

Public Function Integer of_countworkDays (dataWindow Adw_holidays, String As_Columnname, Date Ad_StartDate, Date Ad_ENDDATE); / * Function: Get working days between specified dates

Return value: working day days

Parameters: Adw_holidays DataWindow stores the data window for the holiday

AS_COLUMNNAME STRING Data window storage holiday list

Ad_StartDate Date Start Date

AD_ENDDATE DATE End Date * /

Integer INTDAYS, LI_RETURN

Date D_Temp

Integer INTSUBSTRACT

IF ad_enddate

D_Temp = ad_startdate

ad_nddate = ad_startdate

Ad_startdate = D_TEMP

END IF

Ad_StartDate = of_skipholidays (adw_holidays, as_columnname, ad_startdate, 1)

Ad_nddate = of_skipholidays (adw_holidays, as_columnname, ad_nddate, -1)

IF ad_startdate> ad_enddate then

Li_RETURN = 0

Else

INTDAYS = daySafter (ad_startdate, ad_ennddate) 1

INTSUBSTRACT = INTSUBSTRACT OF_COUNTHOLIDAYS (Adw_holidays, As_ColumnName, Ad_StartDate, Ad_ENDDATE)

END IF

LI_RETURN = INTDAYS - INTSUBSTRACT

Return Li_Return

END FUNCTION

Public Function Date of_GetFirstdayinWeek (Date Ad_Date); / * Function function: Get the first day of the surrounding date

Return Value: Date Returns the first day of the week where the specified date is

Parameters: ad_date date * / Date LD_RETURN

LD_RETURN = RelativeDate (ad_date, 1 - daynumber (ad_date))

Return LD_RETURN

END FUNCTION

Public Function Date of_getlastdayInweek (Date Ad_Date); / * Function: Get the last day of the week where the specified date is located

Return Value: Date Returns the last day of the week where the specified date is located

Parameters: ad_date date Date * /

Date LD_RETURN

LD_RETURN = RelativeDate (ad_date, 7 - dayNumber (ad_date))

Return LD_RETURN

END FUNCTION

Public Function Date of_GetFirstdayinMont (); / * Function: Get the first day of the current date

Return value: Date The first day of the current date

Parameters: Date Ad_Date Date * /

Return Date (Year (toDay ()), MONTH (Today ()), 1)

END FUNCTION

Public function date of_getlastdayinmonth (); / * Function function: Get the last day of the current date

Return Value: The last day of the date current date * /

Return Date (Year ()), Month (Today ()), INTEGER (28 Integer (MID (Sign (Sign (Sign (Sign (SIGN (ABS ("()) , 4)) SIGN (abs ("for")), 100)) SIGN (ABS (ABS (Year (Today ())), 400)), 2)))) ' 3232332323 ', MONTH (Today ()), 1))))))))))

END FUNCTION

Public function Date of_getfirstWorkday (); / * Function function: Get the first working day of the current date

Return Value: Date Returns the first working day of the current date * /

Date D_Temp

D_Temp = Date (Year (Today ()), Month (Today ()), 1)

Return of_skipholidays (D_Temp, 1)

END FUNCTION

Public function date of_getlastworkday (); / * Function: Get the last working day of the current date

Return Value: Date Returns the last working day of the current date * /

Date D_Temp

D_temp = of_getlastdayinmonth (Today ())

Return of_skipholidays (D_Temp, -1)

END FUNCTION

Public Function Date of_GetFirstdayinWeek (); / * Function: Get the first day of the current date

Return Value: Date Returns the first day of the current date

Parameters: ad_date date Date * /

Date LD_RETURN

LD_RETURN = RelativeDate (Today (), 1 - dayNumber (Today ()))

Return LD_RETURN

END FUNCTION

Public Function Date of_GetlastDayinWeek (); / * Function: Get the last day of the week where the specified date is located

Return Value: Date Returns the last day of the surrounding date * / date ld_return

LD_RETURN = RelativeDate (Today (), 7 - dayNumber (Today ()))

Return LD_RETURN

END FUNCTION

Public function Date of_getnextworkday (); / * Function: Get the next working day of the current date skipping weekend

Return Value: Date Returns the current specified date skipping weekend next working day * /

Return of_skipholidays (RelativeDate (Today (), 1), 1)

END FUNCTION

Public Function Date of_GetPreviousWorkday (); / * Function: Get the current date skipping on the weekend day

Return Value: Date Returns the previous date of jump over the weekend * /

Return of_skipholidays (RelativeDate (Today (), - 1), - 1)

END FUNCTION

Public Function Integer of_CouNtholidays (dataWindow Adw_holidays, String As_Columnname, Date Ad_StartDate, Date Ad_Enddate); / * Function: Get a holiday day between the specified date

Return value: holiday days

Parameters: Adw_holidays DataWindow stores the data window for the holiday

AS_COLUMNNAME STRING Data window storage holiday list

Ad_StartDate Date Start Date

AD_ENDDATE DATE End Date * /

Integer Li_Return

Date ld_date

LD_DATE = ad_startdate

Do while ld_date <= ad_nddate

IF of_lsweekend (ld_date) = true or adw_holidays.find ("String (" as_columnname ", 'yyyy-mm-dd')" "= '" string (ld_date, "YYYY-MM-DD") " ", 1, adw_holidays.rowcount ()) = 0 THEN

LI_RETURN

END IF

LD_DATE = RelativeDate (ld_date, 1)

loop

Return Li_Return

END FUNCTION

Public Function Integer of_CouNtholidAys (Date Ad_StartDate, Date Ad_Enddate); / * Function: Get a holiday day between the specified date

Return value: holiday days

Parameters: ad_startdate Date Start Date

AD_ENDDATE DATE End Date * /

Integer Li_Return

Date ld_date

LD_DATE = ad_startdate

Do while ld_date <= ad_nddate

IF of_lsweekend (ld_date) = True Then

LI_RETURN

END IF

LD_DATE = RelativeDate (ld_date, 1)

loop

Return Li_Return

END FUNCTION

Public Function Integer of_CouNtholidays (DATASTORE ADS_HOLIDAYS, STRING AS_COLUMNNAMES, STRING AS_COLUMNNAME, DATE AD_STARTDATE, DATE AD_ENDDATE); / * Function: Get the number of holiday days between the specified date: Holiday days

Parameters: ADS_HOLIDAYS DATASTORE Stores data storage objects for specified holidays

AS_COLUMNNAME STRING Data window storage holiday list

Ad_StartDate Date Start Date

AD_ENDDATE DATE End Date * /

Integer Li_Return

Date ld_date

LD_DATE = ad_startdate

Do while ld_date <= ad_nddate

IF of_lsweekend (ld_date) = true or ads_holidays.find ("" " as_columnname ", 'yyyy-mm-dd') " " = '" string (ld_date," yyy-mm-dd ") "' ", 1, ads_holidays.rowcount ()) = 0 THEN

LI_RETURN

END IF

LD_DATE = RelativeDate (ld_date, 1)

loop

Return Li_Return

END FUNCTION

Public function integer of_countworkDays (datastore ads_holidays, string as_columnname, date ad_startdate, date ad_enddate); / * Function: Get working days between specified dates

Return value: working day days

Parameters: ADS_HOLIDAYS DATASTROE Store Data Storage Objects Specified Holidays

AS_COLUMNNAME STRING Data window storage holiday list

Ad_StartDate Date Start Date

AD_ENDDATE DATE End Date * /

Integer INTDAYS, LI_RETURN

Date D_Temp

Integer INTSUBSTRACT

IF ad_enddate

D_Temp = ad_startdate

ad_nddate = ad_startdate

Ad_startdate = D_TEMP

END IF

Ad_StartDate = of_skipholidays (ads_holidays, as_columnname, ad_startdate, 1)

Ad_nddate = of_skipholidays (ads_holidays, as_columnname, ad_nddate, -1)

IF ad_startdate> ad_enddate then

Li_RETURN = 0

Else

INTDAYS = daySafter (ad_startdate, ad_ennddate) 1

INTSUBSTRACT = INTSUBSTRACT OF_COUNTHOLIDAYS (ADS_HOLIDAYS, AS_COLUMNNAME, AD_STARTDATE, AD_ENDDATE)

END IF

LI_RETURN = INTDAYS - INTSUBSTRACT

Return Li_Return

END FUNCTION

Public Function Integer of_countWorkDays (Date Ad_StartDate, Date Ad_Enddate); / * Function: Gets the number of job daylights between the specified date: Work Day days

Parameters: ad_startdate Date Start Date

AD_ENDDATE DATE End Date * /

Integer INTDAYS, LI_RETURN

Date D_Temp

Integer INTSUBSTRACT

IF ad_enddate

D_Temp = ad_startdate

ad_nddate = ad_startdate

Ad_startdate = D_TEMP

END IF

Ad_startDate = of_skipholidays (ad_startdate, 1)

Ad_nddate = of_skipholidays (ad_enddate, -1)

IF ad_startdate> ad_enddate then

Li_RETURN = 0

Else

INTDAYS = daySafter (ad_startdate, ad_ennddate) 1

INTSUBSTRACT = INTSUBSTRACT OF_COUNTHOLIDAYS (ad_startdate, ad_ennddate)

END IF

LI_RETURN = INTDAYS - INTSUBSTRACT

Return Li_Return

END FUNCTION

Public Function Integer of_getage (Date Ad_BritHDAY, DATE AD_DATE); / * Function: Get the agenda of the specified birthday to the specified date

Function Return Value: Integer Specifies the age of birth to the specified date

Parameters: Date Ad_BritHDay Birth Date

Date ad_date Specify Date * /

Integer li_age

Date LD_TEMP

IF ad_brithday> ad_date then

LD_TEMP = ad_brithday

AD_BRITHDAY = ad_date

Ad_date = ld_temp

END IF

LI_AGE = of_yearsafter (ad_brithday, ad_date)

IF ad_date

LI_AGE = li_age - 1

END IF

RETURN LI_AGE

END FUNCTION

Public Function Long Of_YearSafter (Date Ad_Start, Date Ad_end); / * Function Purpose: Gets the annual difference between the specified date

Return value: long difference year

Parameters: Date Ad_Start Start Date

Date ad_end end date * /

Date LD_TEMP

INT Li_Year, LI_MULT

Double adb_start, adb_end

IF isnull (ad_start) or isnull (ad_end) THEN

Long LL_NULL

SetNULL (LL_NULL)

Return LL_NULL

END IF

IF ad_start> ad_nd dam

LD_TEMP = ad_start

Ad_start = ad_nd

AD_END = ld_temp

Li_MULT = -1

Else

LI_MULT = 1

END IF

Li_Year = year (ad_end) - Year (ad_start)

ADB_START = MONTH (ad_start) ADB_START = adb_start day (ad_start) / 100

ADB_END = MONTH (ad_end)

ADB_END = ADB_END DAY (ad_end) / 100

IF adb_start> adb_end dam

li_year -

END IF

Return li_year * li_mult

END FUNCTION

Public Function Long Of_MontHSAFTER (Date Ad_Start, Date Ad_END); / * Description: Moon Interval between Two Dates

Returns: Month Interval between Two Dates

Parameters: Date Ad_Start Start Date

Date ad_end end date * /

Date LD_TEMP

Integer Li_Month

Integer li_mult

IF isnull (ad_start) or isnull (ad_end) THEN

Long LL_NULL

SetNULL (LL_NULL)

Return LL_NULL

END IF

IF ad_start> ad_nd dam

LD_TEMP = ad_start

Ad_start = ad_nd

AD_END = ld_temp

Li_MULT = -1

Else

LI_MULT = 1

END IF

LI_MONTH = (Year (ad_nd) - Year (ad_start) * 12

LI_MONTH = li_month month (ad_end) - Month (ad_start)

If DAY (ad_start)> day (ad_end) THEN

LI_MONTH -

END IF

RETURN LI_MONTH * LI_MULT

END FUNCTION

Public Function Long Of_WeekSafter (Date Ad_Start, Date Ad_end); / * Function Purpose: Gets the difference between the specified date

Return Value: long variability

Parameters: Date Ad_Start Start Date

Date ad_end end date * /

IF isnull (ad_start) or isnull (ad_end) THEN

Long LL_NULL

SetNULL (LL_NULL)

Return LL_NULL

END IF

Return DaySafter (ad_start, ad_end) / 7

END FUNCTION

Public function long of_secondsafter (DateTime Adtm_Start, DateTime ADTM_END); / * Function Uses: Gets the number of different minutes between specified date

Return Value: LONG phase difference

Parameters: DateTime ADTM_Start Start Time

DateTime ADTM_END End Time * /

Long ll_total_seconds, LL_DAY_ADJUST

Date ld_sdate, ld_edate

Time LT_STIME, LT_ETIME

IF isnull (ADTM_START) or isnull (ADTM_END) THEN

Long LL_NULL

SetNULL (LL_NULL)

Return LL_NULL

END IF

LD_SDATE = DATE (ADTM_START)

LD_EDATE = DATE (ADTM_END)

LT_stime = Time (ADTM_START)

LT_ETIME = TIME (ADTM_END)

IF ld_sdate = ld_edate the

Ll_total_seconds = secondsafter (lt_stime, lt_etime) elseif ld_sdate

LL_TOTAL_SECONDS = Secondsafter (LT_STIME, TIME ('23: 59: 59 '))))

LL_DAY_ADJUST = DaySafter (ld_sdate, ld_edate) -1

IF ll_day_adjust> 0 THEN LL_TOTAL_SECONDS = LL_TOTAL_SECONDS 86400 * LL_DAY_ADJUST

LL_TOTAL_SECONDS = LL_TOTAL_SECONDS Secondsafter (Time ('00: 00: 00 '), LT_ETIME) 1

Else

LL_TOTAL_SECONDS = Secondsafter (LT_STIME, TIME ('00: 00: 00 '))

LL_DAY_ADJUST = DaySafter (ld_sdate, ld_edate) 1

IF ll_day_adjust <0 THEN LL_TOTAL_SECONDS = LL_TOTAL_SECONDS 86400 * LL_DAY_ADJUST

LL_TOTAL_SECONDS = LL_TOTAL_SECONDS Secondsafter (Time ('23: 59: 59), LT_ETIME) -1

END IF

Return LL_TOTAL_SECONDS

END FUNCTION

Public Function Long Of_MilliseCsafter (Time ATM_START, TIME ATM_END); / * Function Purpose: Gets the difference between the specified time

Return Value: LONG phase difference

Parameters: Time ATM_START start time

Time ATM_END End Time * /

Long ll_start, ll_end

Long LL_TEMP

IF isnull (atm_start) or isnull (atm_end) THEN

Long LL_NULL

SetNULL (LL_NULL)

Return LL_NULL

END IF

LL_Start = long (String (ATM_Start, "FFF")))

LL_TEMP = SECOND (ATM_Start) * 1000

LL_Start = LL_Start LL_TEMP

LL_TEMP = Minute (atm_start) * 60000

LL_Start = LL_Start LL_TEMP

LL_TEMP = Hour (atm_start) * 3600000

LL_Start = LL_Start LL_TEMP

LL_END = long (String (ATM_END, "FFF")))

LL_TEMP = SECOND (ATM_END) * 1000

LL_END = LL_END LL_TEMP

LL_TEMP = Minute (ATM_END) * 60000

LL_END = LL_END LL_TEMP

LL_TEMP = Hour (atm_end) * 3600000

LL_END = LL_END LL_TEMP

RETURN LL_END - LL_START

END FUNCTION

Public Function Date of_RALATIVEMOTH (Date Ad_Source, Integer Al_Mont); / * Function: Returns the date return value after the specified date phase specified specified month: Date Specifies the date after the date of specification

Parameters: Date Ad_Source Initial Date

Integer Al_MontH month * /

Integer li_adjust_months, li_adjust_year

Integer li_month, li_year, li_day

Integer Li_Temp_Month

IF isnull (ad_source) or isnull (al_month) THEN

Date LDT_NULL

Setnull (LDT_NULL)

Return LDT_NULL

END IF

LI_ADJUST_MONTHS = MOD (al_month, 12)

Li_ADJUST_YEARS = (Al_MontH / 12)

LI_TEMP_MONTH = MONTH (ad_source) li_adjust_months

IF li_temp_month> 12 THEN

LI_MONTH = li_temp_month - 12

Li_ADJUST_YAARS

Elseif Li_TEMP_MONTH <= 0 THEN

LI_MONTH = li_temp_month 12

li_adjust_years -

Else

LI_MONTH = li_temp_month

END IF

Li_Year = Year (ad_source) li_adjust_year

LI_DAY = day (ad_source)

Do while li_day> 0

LI_DAY -

Loop

Date LD_RET

LD_RET = Date (li_year, li_month, li_day)

Return LD_RET

END FUNCTION

Public Function DateTime Of_RELATIVEDATETIME (DateTime ADTM_Start, Integer Al_offset); / * Function: Returns the time after the specified time difference specifies the number of seconds

Return Value: DateTime Specifies the time after the time difference specifies the number of seconds

Parameters: DateTime ADTM_START Initial Time

Integer Al_Month second number * /

DateTime LDT_NULL

Date ld_sdate

Time lt_stime

Long ll_date_adjust

Long ll_time_adjust, ll_time_test

If isnull (ADTM_Start) or isnull (al_offset) THEN

Setnull (LDT_NULL)

Return LDT_NULL

END IF

LD_SDATE = DATE (ADTM_START)

LT_stime = Time (ADTM_START)

LL_DATE_ADJUST = Al_offset / 86400

LL_TIME_ADJUST = MOD (Al_offset, 86400)

LD_SDATE = RelativeDate (ld_sdate, ll_date_adjust)

IF ll_time_adjust> 0 THEN

LL_TIME_TEST = Secondsafter (LT_STIME, TIME ('23: 59: 59 ')))

IF ll_time_test

ld_sdate = relativedate (LD_SDATE, 1)

LL_TIME_ADJUST = LL_TIME_ADJUST - LL_TIME_TEST -1LT_STIME = Time ('00: 00: 00 ')

END IF

LT_stime = relativetime (LT_STIME, LL_TIME_ADJUST)

Elseif Ll_time_adjust <0 THEN

LL_TIME_TEST = Secondsafter (LT_STIME, TIME ('00: 00: 00 '))))

IF ll_time_test> LL_TIME_ADJUST THEN

LD_SDATE = RelativeDate (ld_sdate, -1)

LL_TIME_ADJUST = LL_TIME_ADJUST - LL_TIME_TEST 1

LT_stime = Time ('23: 59: 59 ')

END IF

LT_stime = relativetime (LT_STIME, LL_TIME_ADJUST)

END IF

Return (DateTime (ld_sdate, lt_stime))

END FUNCTION

Public Function Integer of_getquarter (Date Ad_Source); / * Function: Get the quarter of the specified date

Return Value: Integer Specifies the quarter in the date

Parameters: Date Ad_Source Date * /

IF isnull (ad_source) THEN

Long LL_NULL

SetNULL (LL_NULL)

Return LL_NULL

END IF

Integer li_month, li_quarter

LI_MONTH = Month (ad_source)

Li_quarter = (li_month -1) / 3

Return li_quarter

END FUNCTION

Public Function Integer of_getquarter (); / * Function: Get the quarter of the current date

Return Value: Integer's quarter of the current date * /

Integer li_month, li_quarter

LI_MONTH = Month (Today ())

Li_quarter = (li_month -1) / 3

Return li_quarter

END FUNCTION

Public Function Date Of_GetFirstdayinquarter (Date Ad_Date); / * Function Purpose: Get the first day of the quarter where the specified date is

Return Value: Date The first day of the quarter where the date is located

Parameters: DATE AD_DATE Specified Date * /

Date LD_RETURN

Constant Integer Li_Monthsinquarter = 3

LD_RETURN = DATE (Year (ad_date), INT ((Month (ad_date) - 1) / li_monthsinquarter * li_monthsinquarter 1, 1)

Return LD_RETURN

END FUNCTION

Public Function Date of_GetFirstdayinquarter (); / * Function Purpose: Get the first day of the quarter where the current date is located

Return Value: The first day of the quarter where the date is currently available * /

Date LD_RETURN

Constant Integer Li_Monthsinquarter = 3

LD_RETURN = Date (Year (toDay ()), int ((Month (Today ()) - 1) / li_monthsinquarter * li_monthsinquarter 1, 1)

Return LD_RETURN

END FUNCTION

Public function Date of_getlastdayinquarter (Date Ad_Date); / * Function Purpose: Get the last day of the quarter of the specified date: Date The last day of the quarter where the date is specified

Parameters: DATE AD_DATE Specified Date * /

Date LD_RETURN

Constant Integer Li_Monthsinquarter = 3

LD_RETURN = DATE (Year (ad_date), INT ((Month (AD_DATE) - 1) / li_monthsinquarter * li_monthsinquarter (li_monthsinquarter 1), Integer (28 Integer (MID (ABS (Sign (SIGN (MOD) SIGN (MOD (ABS (ABS (ABS (ABS (ABS (ABS (ABS (ABS (ABS (ABS (ABS (ABS (ABS (Year (AD_DATE)), 400), 2) ) -1)) '3232332323', Month (ad_date), 1))))))

Return LD_RETURN

END FUNCTION

PUBLIC FUNCTION DATE OF_GETLASTDAYINQUARTER (); / * Function Purpose: Get the last day of the quarter where the current date is located

Return Value: The last day of the quarter of Date current date * /

Date LD_RETURN

Constant Integer Li_Monthsinquarter = 3

LD_RETURN = Date (Year (Today ()), Int ((Month (Today ()) - 1) / li_monthsinquarter * l_monthsinquarter (li_monthsinquarter 1), Integer (28 Integer (MID (ABS (ABS Sign (MOD (abs (abs (abs (abs)), 4)) SIGN (ABS (ABS (ABS (ABS ("tDay ())), 100)) Sign (ABS (ABS (" ))), 400), 2)) -1)) '3232332323', month (Today ()), 1)))))

Return LD_RETURN

END FUNCTION

Public Function Long of_CountWeeksinyear (Date Ad_Source); / * Function Purpose: Get the number of weeks in the year of the specified date

Return Value: Long return date of the week

Parameters: Date Ad_Source Specified Date * /

Date ld_first_ofyear

Integer li_weeknumber

Integer Li_LEFTOVER_DAYS

IF isnull (ad_source) THEN

Long LL_NULL

SetNULL (LL_NULL)

Return LL_NULL

END IF

LD_First_ofyear = Date (year (ad_source), 1, 1)

LI_WEEKNUMBER = of_weeksafter (ld_first_ofyear, ad_source) 1

LI_LEFTOVER_DAYS = MOD (DaySafter (ld_first_ofyear, ad_source), 7)

IF (of_getdayinweek li_leftover_days> = 8 THEN

LI_WeekNumber

END IF

Return li_weeknumber

END FUNCTION

Public function integer of_getdayinweek (Date Ad_Source); // Description: The Decision date is the day of the week, and the first day of Sunday as a week.

// Parameter:

// [value] Date Ad_Source

// Return: (Integer)

// 1 - if the day is sunday.

// 2 - if The day is monday

// 3 - if the day is tuesday.

// 4 - if the day is wednesday.

//5 - if the day is strayday.

// 6 - if the day is.

// 7 - if the day is saturday.

// if any argument's value is null, Function Returns Null.

//

IF isnull (ad_source) THEN

Long LL_NULL

SetNULL (LL_NULL)

Return LL_NULL

END IF

Return dayNumber (ad_source)

END FUNCTION

Public Function Date of_GetFirstdayinyear (Date Ad_Date); / * Function: Get the first day of the year of the specified date

Return value: Date The first day of the year

Parameters: Date Ad_Date Date * /

Return Date (Year (ad_date), 1, 1)

END FUNCTION

Public Function Date of_GetFirstdayinyear (); / * Function: Get the first day of the current date

Return Value: The first day of the date of the date current date

Parameters: Date Ad_Date Date * /

Return Date (Year (Today ()), 1, 1)

END FUNCTION

Public Function Date of_GetFirstdayinyear (Integer Ai_Year); / * Function: Get the first day of the designated year

Return Value: Date The first day of the designated year

Parameters: Date Ad_Date Date * /

Return Date (ai_year, 1, 1)

END FUNCTION

Public function Date of_getlastdayinyear (Date Ad_Date); / * Function: Get the last day of the year in which the specified date is located

Return Value: Date Specifies the last day of the year

Parameters: Date Ad_Date Date * /

Return Date (Year (ad_date), 12,31)

END FUNCTION

Public function date of_getlastdayinyear (); / * Function: Get the last day of the year of the current date

Return Value: The last day of the date of the current date

Parameters: Date Ad_Date Date * /

Return Date (Year (Today ()), 12,31)

END FUNCTION

Public Function Date of_getlastdayInyear (Integer Ai_Year); / * Function: Get the last day of the year in which the specified date is

Return Value: Date Specifies the last day of the year

Parameters: integer ai_year year * /

Return Date (ai_year, 12,31)

END FUNCTION

Public Function Integer of_countyeardAys (Date Ad_Date); / * Function Purpose: Get the number of days in the designated date

Function Return Value: Integer Number

Parameters: Date Ad_Date Date * /

Return DaySafter (of_getfirstdayinyear (ad_date), of_getlastdayinyear (ad_date))

END FUNCTION

Public Function Integer of_countyearDays (); / * Function Purpose: Get the number of days in the current date

Function Return Value: Integer Number * /

Return DaySafter (of_getfirstdayinyear (), of_getlastdayinyear ())

END FUNCTION

Public Function Integer of_countyeardAys (Integer Ai_Year); / * Function Purpose: Get the number of days in the designated year

Function Return Value: Integer Number

Parameters: integer ai_year year * /

Return DaySafter (of_getfirstdayinyear (ai_year), of_getlastdayinyear (ai_year))

END FUNCTION

Public function string of_getconstellation; / * Function Purpose: Returns the constellation of the specified date

Return Value: String Specify the constellation

Parameters: DATE AD_DATE Specified Date * /

Return MID ("Capricorn Bottle Pisces White Cattle Gemini Giant Crab Lion Women Sky Scorpio Shooting Capricorn" , 1)))) 1)) * 4 -3, 4) '

END FUNCTION

Public function string of_getgenus (integer ai_year); / * Function: Get the zodiac of the designated year

Return value: String Returns the zodiac of the designated year

Parameters: ai_year integer year * /

String Ls_Return

SetNull (Ls_Return)

IF ai_year <1900 Then Return Ls_Return

Ls_return = MID (Fill ('rat cattle tiger rabbit dragon snake horse sheather chicken dog ", 48), (MOD (ai_year -1900, 12) 13) * 2 -1, 2)

Return Ls_Return

END FUNCTION

Public function string of_convertdayoflunar (date ad_date); string weekname [0 to 7], tiangan [0 to 9], dizhi [0 to 11], shuxiang [0 to 11], dayname [0 to 30], Monname [0 to 12 ]

Long Monthadd [0 to 11], Nonglidata [0 to 99]

Long Curtime, Curyear, Curmonth, Curday, Curweekday

String gonglistr, weekdaystr, nonglistr, nonglidaystr

LONG I, M, N, K, Isend, Bit, THEDATE

Weekname [0] = "*"

Weekname [1] = "Sunday"

Weekname [2] = "Monday"

Weekname [3] = "Tuesday" weekname [4] = "Wednesday"

Weekname [5] = "Thursday"

Weekname [6] = "Friday"

Weekname [7] = "Saturday"

// Tiandan name

TIANGAN [0] = "A"

Tiangan [1] = "B"

Tiangan [2] = ""

Tiangan [3] = "Ding"

Tiangan [4] = "gluta"

Tiangan [5] = "self"

Tiangan [6] = "Geng"

Tiangan [7] = "Xin"

TIANGAN [8] = ""

Tiangan [9] = ""

// Sound name

Dizhi [0] = "Sub"

Dizhi [1] = "ugly"

Dizhi [2] = ""

Dizhi [3] = ""

Dizhi [4] = "Chen"

Dizhi [5] = ""

Dizhi [6] = "noon"

Dizhi [7] = "Not"

Dizhi [8] = "Shen"

Dizhi [9] = ""

Dizhi [10] = ""

Dizhi [11] = "Hai"

// belly name

Shuxiang [0] = "rat"

Shuxiang [1] = "Niu"

Shuxiang [2] = "Tiger"

Shuxiang [3] = "Rabbit"

Shuxiang [4] = "Dragon"

Shuxiang [5] = "Snake"

Shuxiang [6] = "Ma"

Shuxiang [7] = "Sheep"

Shuxiang [8] = "Monkey"

Shuxiang [9] = "Chicken"

Shuxiang [10] = "Dog"

Shuxiang [11] = "Pig"

// Lunar Calendar

DayName [0] = "*"

DayName [1] = "First"

DayName [2] = "First 2"

DayName [3] = "First Three"

DayName [4] = "First Four"

DayName [5] = "First Five"

DayName [6] = "First Six"

DayName [7] = "First Seven"

DayName [8] = "First Eight"

DayName [9] = "Jijiu"

DayName [10] = "First Ten"

DayName [11] = "11"

DayName [12] = "Twelve"

DayName [13] = "13"

DayName [14] = "14"

DayName [15] = "fifteen"

DayName [16] = "16"

DayName [17] = "seventeen" daysname [18] = "18"

Dayname [19] = "19"

DayName [20] = "twenty"

DayName [21] = "一"

DayName [22] = "廿 二"

DayName [23] = "三"

DayName [24] = "four"

DayName [25] = "五"

DayName [26] = "六"

DayName [27] = "廿七"

DayName [28] = "八"

Dayname [29] = "九"

DayName [30] = "thirty"

// Lunar Month Name

Monname [0] = "*"

Monname [1] = "positive"

Monname [2] = "two"

Monname [3] = "three"

Monname [4] = "four"

Monname [5] = "five"

Monname [6] = "six"

Monname [7] = "seven"

Monname [8] = "eight"

Monname [9] = "Nine"

Monname [10] = "Ten"

Monname [11] = "11"

Monname [12] = "La"

// The number of days before the question

MONTHADD [0] = 0

MONTHADD [1] = 31

MONTHADD [2] = 59

MONTHADD [3] = 90

MONTHADD [4] = 120

MONTHADD [5] = 151

MONTHADD [6] = 181

MONTHADD [7] = 212

MONTHADD [8] = 243

MONTHADD [9] = 273

MONTHADD [10] = 304

MONTHADD [11] = 334

// Lunar Data

Nonglidata [0] = 2635

Nonglidata [1] = 333387

Nonglidata [2] = 1701

Nonglidata [3] = 1748

Nonglidata [4] = 267701

Nonglidata [5] = 694

Nonglidata [6] = 2391

Nonglidata [7] = 133423

Nonglidata [8] = 1175

Nonglidata [9] = 396438

Nonglidata [10] = 3402

Nonglidata [11] = 3749

Nonglidata [12] = 331177

Nonglidata [13] = 1453

Nonglidata [14] = 694

Nonglidata [15] = 201326

Nonglidata [16] = 2350

Nonglidata [17] = 465197

Nonglidata [18] = 3221

Nonglidata [19] = 3402

Nonglidata [20] = 400202

Nonglidata [21] = 2901

Nonglidata [22] = 1386nonglidata [23] = 267611

Nonglidata [24] = 605

Nonglidata [25] = 2349

Nonglidata [26] = 137515

Nonglidata [27] = 2709

Nonglidata [28] = 464533

Nonglidata [29] = 1738

Nonglidata [30] = 2901

Nonglidata [31] = 330421

Nonglidata [32] = 1242

Nonglidata [33] = 2651

Nonglidata [34] = 199255

Nonglidata [35] = 1323

Nonglidata [36] = 529706

Nonglidata [37] = 3733

Nonglidata [38] = 1706

Nonglidata [39] = 398762

Nonglidata [40] = 2741

Nonglidata [41] = 1206

Nonglidata [42] = 267438

Nonglidata [43] = 2647

Nonglidata [44] = 1318

Nonglidata [45] = 204070

Nonglidata [46] = 3477

Nonglidata [47] = 461653

Nonglidata [48] = 1386

Nonglidata [49] = 2413

Nonglidata [50] = 330077

Nonglidata [51] = 1197

Nonglidata [52] = 2637

Nonglidata [53] = 268877

Nonglidata [54] = 3365

Nonglidata [55] = 531109

Nonglidata [56] = 2900

Nonglidata [57] = 2922

Nonglidata [58] = 398042

Nonglidata [59] = 2395

Nonglidata [60] = 1179

Nonglidata [61] = 267415

Nonglidata [62] = 2635

Nonglidata [63] = 661067

Nonglidata [64] = 1701

Nonglidata [65] = 1748

Nonglidata [66] = 398772

Nonglidata [67] = 2742

Nonglidata [68] = 2391

Nonglidata [69] = 330031

Nonglidata [70] = 1175

Nonglidata [71] = 1611

Nonglidata [72] = 200010

Nonglidata [73] = 3749

Nonglidata [74] = 527717

Nonglidata [75] = 1452

Nonglidata [76] = 2742

Nonglidata [77] = 332397

Nonglidata [78] = 2350

Nonglidata [79] = 3222

Nonglidata [80] = 268949

Nonglidata [81] = 3402

Nonglidata [82] = 3493

Nonglidata [83] = 133973

Nonglidata [84] = 1386

Nonglidata [85] = 464219nonglidata [86] = 605

Nonglidata [87] = 2349

Nonglidata [88] = 334123

Nonglidata [89] = 2709

Nonglidata [90] = 2890

Nonglidata [91] = 267946

Nonglidata [92] = 2773

Nonglidata [93] = 592565

Nonglidata [94] = 1210

Nonglidata [95] = 2651

Nonglidata [96] = 395863

Nonglidata [97] = 1323

Nonglidata [98] = 2707

Nonglidata [99] = 265877

Curyear = year (ad_date)

Curmonth = month (ad_date)

CURDAY = day (ad_date)

Gonglistr = String (Curyear) "Year"

IF (Curmonth <10) THEN

Gonglistr = Gonglistr "0" String (curmonth) "Month"

Else

Gonglistr = Gonglistr String (Curmonth) "Month"

END IF

IF (Curday <10) THEN

Gonglistr = gonglistr "0" string (curday) "Day"

Else

GONGLISTR = Gonglistr String (Curday) "Day"

END IF

/ / Generate the current question Master Week ==> Weekdaystr

Curweekday = dayNumber (ad_date)

Weekdaystr = weekname [curweekday]

// Calculate the number of days on February 8, 1921: 1921-2-8 (first month of the first month)

THEDATE = (Curyear - 1921) * 365 Int ((Curyear - 1921) / 4) Curday Monthadd [CURMONTH - 1] - 38

IF (Mod (Curyear, 4) = 0 and curmonth> 2) THEN

TheDate = theseDate 1

END IF

// Calculate the lunar calendar, the land, month, day

Isend = 0

M = 0

DO

IF (Nonglidata [M] <4095) THEN

K = 11

Else

K = 12

END IF

N = K

DO

IF (n <0) THEN

Exit

END IF

/ / Get the value of Nonglidata (M) of Nth binary bit

Bit = nonglidata [M]

For i = 1 to n step 1

Bit = int (bit / 2)

NEXT

Bit = mod (bit, 2)

IF (Twate <= 29 bit) THEN

Isend = 1

Exit

END IF

THEDATE = thesedate - 29 - bit

n = n - 1

LOOP Until 1 <> 1

IF (isend = 1) THENEXIT

END IF

m = m 1

LOOP Until 1 <> 1

Curyear = 1921 M

Curmonth = K - N 1

Curday = thesedate

IF (k = 12) THEN

IF (curmonth = (INT (Nonglidata [M] / 65536) 1)) THEN

Curmonth = 1 - Curmonth

Elseif (Curmonth> (INT (Nonglidata [M] / 65536) 1)) THEN

Curmonth = curmonth - 1

END IF

END IF

/ / Generate the lunar calendar day, the land, the belongs ==> Nonglistr

Nonglistr = "Lunar" Tiangan [Mod (Curyear - 4, 60), 10)] Dizhi [MOD (MOD (Curyear - 4, 60), 12)] "Year"

Nonglistr = Nonglistr "(" Shuxiang [MOD (MOD (Cury (Curyear - 4, 60), 12)] ")"

/ / Generate a lunar month, day ==> nonglidayStr

Curmonth <1) THEN

NonglidayStr = "" Monname [-1 * curmonth]

Else

NonglidayStr = Monname [curmonth]

END IF

NonglidayStr = NongLidayStr "Month"

NonglidayStr = NongLidayStr DayName [curday]

Return Nonglistr NonglidayStr

END FUNCTION

PUBLIC FUNCTION DATETIME OF_RELATIVEDATETIME (datetime ad_datetime, long al_number, string as_kind); // ****************************************************** ***************************************************** //

// Function name: f_relativeDataTime (DataTime Ad_DateTime, long al_number, string al_kind)

// Uses: Calculate the relative date of the DataTime type

// Enter: Date, relative quantity, unit (day, hour, minute, second)

// Out: Date time after calculation

// ******************************************************** ****************************** //

Long Ll_RELASECOND, LL_SECOND

Time LT_TIME

Date ld_date

Constant Long Onesecond = 86400

LD_DATE = DATE (ad_datetime)

LT_TIME = TIME (ad_datetime)

Choose Case As_Kind

Case "Day"

Return DateTime (RelativeDate (LD_DATE, AL_NUMBER), LT_TIME)

Case "hour"

LL_RELATIVESECOND = AL_NUMBER * 3600CASE "points"

LL_RELATIVESECOND = AL_NUMBER * 60

Case "second"

LL_RELATIVESECOND = AL_NUMBER

End chaoose

LL_Second = Hour (LT_TIME) * 3600 Minute (LT_TIME) * 60 Second (LT_TIME)

LD_DATE = RelativeDate (ld_date, integer (ll_relaventivesecond / onesecond))

LL_RELATIVESECOND - = INTEGER (LL_RELATISECOND / OneDaysecond) * Onesecond

IF (LL_Second LL_RELATIVESECOND <0) THEN

Return DateTime (RelativeDate (LD_DATE, -1), RelativeTime (Time ("00: 00: 00: 000"), Onesecond LL_Second LL_RELASECOND))

END IF

IF (LL_Second LL_RELATIVESECOND> Onesecond) THEN

Return DateTime (RevelDate (LD_DATE, 1), RelativeTime (Time ("00: 00: 00: 000"), LL_Second LL_RELASECESECOND - Onesecond))

END IF

Return DateTime (LD_DATE, RELATIVETIME (LT_TIME, LL_RELATISECOND))

END FUNCTION

Public Function String of_getTGDZ (Integer Ai_Year); / * Function: Get the sky-drying of the designated year

Return Value: String Returns the days of the designated year

Parameters: ai_year integer year * /

String Ls_Return

SetNull (Ls_Return)

IF ai_year <1924 Then Return Ls_Return

LS_RETURN = MID (Fill ('Methyl British 丁 庚 辛 壬', 40), (MOD (Ai_Year -1924, 10) 11) * 2 -1, 2) MID (Fill ('Zi Junchen noater戌 海 ', 48), (MOD (Ai_Year -1924, 12) 13) * 2 -1, 2)

Return Ls_Return

END FUNCTION

Public Function String of_getTGDZ (DATE AD_DATE); / * Function: Get the annual dry land branch of the designated date

Return Value: String Returns the annual dry land branch of the designated date

Parameters: ad_date date year * /

Integer al_year

String Ls_Return

SetNull (Ls_Return)

Al_Year = year (ad_date)

IF al_year <1924 Then Return Ls_Return

LS_RETURN = MID (Fill ('methyl isthyl 丁 丁 庚 辛 壬', 40), (MOD (AL_Year -1924, 10) 11) * 2 -1, 2) MID (Fill ('Ziqi Yuchen no afternoon戌 海 ', 48), (MOD (Al_Year -1924, 12) 13) * 2 -1, 2) Return LS_RETURN

END FUNCTION

Public Function String of_getTGDZ (); / * Function: Get the annual dry land of the current date

Return Value: String Returns the days of the day when the current date is located * /

Integer al_year

String Ls_Return

SetNull (Ls_Return)

Al_Year = year (Today ())

IF al_year <1924 Then Return Ls_Return

LS_RETURN = MID (Fill ('methyl isthyl 丁 丁 庚 辛 壬', 40), (MOD (AL_Year -1924, 10) 11) * 2 -1, 2) MID (Fill ('Ziqi Yuchen no afternoon戌 海 ', 48), (MOD (AL_YEAR-1924, 12) 13) * 2 -1, 2)

Return Ls_Return

END FUNCTION

Public Function Boolean of_ISLAPYEAR (); / * Function: Whether the date of the current date is a leap year

Return value: Boolean's current date is a leap year, true is a leap year, false is a year * /

Integer li_year

Li_Year = Year (Today ())

Return ABS (Sign (MOD (MOD (ABS (ABS (LI_Year), 4)) SIGN (MOD (ABS (LI_Year), 100)) SIGN (MOD (ABS (LI_Year), 400), 2)) 1) = 1

END FUNCTION

Public Function String of_GETGENUS (Date Ad_Date); / * Function: Get the Zodiac of the Year of the Specified Date

Return Value: String Returns the Zodiac of the Year of the Specified Date

Parameters: ad_date date Date * /

Integer li_year

String Ls_Return

Li_Year = year (ad_date)

SetNull (Ls_Return)

IF li_year <1900 Ten Return Ls_Return

Ls_RETURN = MID (Fill ('rat cattle tiger rabbit dragon snake horse sheather chicken dog ", 48), (MOD (li_year -1900, 12) 13) * 2 -1, 2)

Return Ls_Return

END FUNCTION

Public function string of_getgenus (); / * Function: Get the year of the year in the current date

Return Value: String Returns the Zodiac of the Year of the Current Date * /

Integer li_year

String Ls_Return

Li_Year = Year (Today ())

SetNull (Ls_Return)

IF li_year <1900 Ten Return Ls_Return

Ls_RETURN = MID (Fill ('rat cattle tiger rabbit dragon snake horse sheather chicken dog ", 48), (MOD (li_year -1900, 12) 13) * 2 -1, 2)

Return Ls_Return

END FUNCTION

Public function integer of_countdowinmonth (); / * Function function: Get the number of days of the day of the day of the current date of the day return value: Integer's current date of the day of the day * /

Return of_countdowinmonth (Today (), 2)

END FUNCTION

Public Function Integer of_getage (Date Ad_BritHDay); / * Function: Get the agenda of the specified birthday to the current date

Function Return Value: Integer Specifies the age of birthday to the current date

Parameters: Date Ad_BrithDay Birth Date * /

Integer li_age

Date ld_date

Date LD_TEMP

LD_DATE = Today ()

IF ad_brithday> ld_date kil

LD_TEMP = ad_brithday

AD_BRITHDAY = LD_DATE

LD_DATE = LD_TEMP

END IF

LI_AGE = of_yearsafter (ad_brithday, ld_date)

IF ld_date

LI_AGE = li_age - 1

END IF

RETURN LI_AGE

END FUNCTION

Public Function Integer of_countdowinmonth (Integer Ai_dow); / * Function: Get specified days of the day of the month of the current date

Return Value: Integer Specifies the number of days of the day of the current month

Parameters: AI_DOW INTEGER Special Week 1 represents Sunday ... 7 represents Saturday * /

Date D_First

Integer Intcount, Intmonth

IF (AI_DOW <1 or Ai_DOW> 7) THEN

AI_DOW = dayNumber (Today ())

END IF

INTMONTH = MONTH (Today ())

D_First = Date (Year (Today ()), Month (Today ()), 1)

Do While DayNumber (D_First) <> ai_dow

D_first = relativedate (D_First, 1)

loop

INTCOUNT = 0

Do While Month (D_First) = IntMonth

INTCOUNT = INTCOUNT 1

D_first = relativedate (D_First, 7)

loop

Return Intcount

END FUNCTION

Public function long of_countweeksinyear (); / * Function Purpose: Get the number of days in the current date

Return Value: Long Returns the number of days in the current date * /

Date ld_first_ofyear

Integer li_weeknumber

Integer Li_LEFTOVER_DAYS

LD_First_ofyear = Date (Year (Today ()), 1, 1)

LI_WEEKNUMBER = of_weeksafter (ld_first_ofyear, Today ()) 1

LI_LEFTOVER_DAYS = MOD (DaySafter (LD_First_ofyear, Today ()), 7)

IF (of_getdayinweek li_leftover_days> = 8 THEN

LI_WeekNumber

End ifreturn li_weeknumber

END FUNCTION

Public Function Boolean of_setSystemTime (DateTime ADT_DATETIME); STC_SYSTEMTIME LSTC_SYSTEMTIME

Date ld_date

Time LT_TIME

LD_DATE = DATE (ADT_DATETIME)

LT_TIME = TIME (ADT_DATETIME)

LSTC_SYSTEMTIME.WYEAR = year (ld_date)

LSTC_SYSTEMTIME.WMONTH = MONTH (LD_DATE)

LSTC_SYSTEMTIME.WDAY = day (ld_date)

LSTC_SYSTEMTIME.WDAYOFWEEK = dayNumber (ld_date)

LSTC_SYSTEMTIME.WHOUR = Hour (lt_time)

LSTC_SYSTEMTIME.WMINUTE = Minute (LT_TIME)

LSTC_SYSTEMTIME.WSECOND = Minute (LT_TIME)

LSTC_SYSTEMTIME.WMILLISECONDS = 0

Return setsystemtime (LSTC_SYSTEMTIME) <> 0

END FUNCTION

On nvo_datetime.create

Call Super :: Create

Triggerevent (this, "constructor")

End on

ON NVO_DATETIME.DESTROY

Triggerevent (this, "destructor")

Call Super :: Destroy

End on

Event constructor; // **************************************************************** ************ //

// NVO_DATETIME Date Time Operation Class, self-created invisible user object //

// Author: tiantianpb //

// Write Date: 2003-11-16 //

// USED: Packaged package for various commonly used datetime operations //

// ******************************************************** ********* //

End Event

转载请注明原文地址:https://www.9cbs.com/read-113782.html

New Post(0)