起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 269|回复: 7

【搞定】如何在代码中使用表达式里的函数??**

[复制链接]
发表于 2007-5-14 16:42:20 | 显示全部楼层 |阅读模式
如题,在代码中使用表达式里的函数,如时间差,
要怎么写??其中计算时间差的函数是在那个类库下的??
回复

使用道具 举报

发表于 2007-5-14 17:48:14 | 显示全部楼层
用 XXX\\Developer\help\StudioHelp.exe 查找
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-5-15 10:00:17 | 显示全部楼层
晕,,,,正因为找不到才问,,
回复 支持 反对

使用道具 举报

发表于 2007-5-15 10:08:08 | 显示全部楼层
DateUtils = class(System.Object)
public
  DayFriday: Shortint;
  DayMonday: Shortint;
  DaySaturday: Shortint;
  DaysPerWeek: Shortint;
  DaysPerYear: array of Word;
  DaySunday: Shortint;
  DayThursday: Shortint;
  DayTuesday: Shortint;
  DayWednesday: Shortint;
  MonthsPerYear: Shortint;
  OneHour: Double;
  OneMillisecond: Double;
  OneMinute: Double;
  OneSecond: Double;
  RecodeLeaveFieldAsIs: Word;
  WeeksPerFortnight: Shortint;
  YearsPerCentury: Shortint;
  YearsPerDecade: Shortint;
  YearsPerMillennium: Smallint;
  static function CompareDate(A: Double; B: Double): Shortint;
  static function CompareDateTime(A: Double; B: Double): Shortint;
  static function CompareTime(A: Double; B: Double): Shortint;
  static function DateOf(AValue: Double): Double;
  static function DateTimeToJulianDate(AValue: Double): Double;
  static function DateTimeToModifiedJulianDate(AValue: Double): Double;
  static function DateTimeToUnix(AValue: Double): Int64;
  static function DayOf(AValue: Double): Word;
  static function DayOfTheMonth(AValue: Double): Word;
  static function DayOfTheWeek(AValue: Double): Word;
  static function DayOfTheYear(AValue: Double): Word;
  static function DaysBetween(ANow: Double; AThen: Double): Longint;
  static function DaysInAMonth(AYear: Word; AMonth: Word): Word;
  static function DaysInAYear(AYear: Word): Word;
  static function DaysInMonth(AValue: Double): Word;
  static function DaysInYear(AValue: Double): Word;
  static function DaySpan(ANow: Double; AThen: Double): Double;
  static procedure DecodeDateDay(AValue: Double; AYear: Word; ADayOfYear: Word);
  static procedure DecodeDateMonthWeek(AValue: Double; AYear: Word; AMonth: Word; AWeekOfMonth: Word; ADayOfWeek: Word);
  static procedure DecodeDateTime(AValue: Double; AYear: Word; AMonth: Word; ADay: Word; AHour: Word; AMinute: Word; ASecond: Word; AMilliSecond: Word);
  static procedure DecodeDateWeek(AValue: Double; AYear: Word; AWeekOfYear: Word; ADayOfWeek: Word);
  static procedure DecodeDayOfWeekInMonth(AValue: Double; AYear: Word; AMonth: Word; ANthDayOfWeek: Word; ADayOfWeek: Word);
  static function EncodeDateDay(AYear: Word; ADayOfYear: Word): Double;
  static function EncodeDateMonthWeek(AYear: Word; AMonth: Word; AWeekOfMonth: Word; ADayOfWeek: Word): Double;
  static function EncodeDateTime(AYear: Word; AMonth: Word; ADay: Word; AHour: Word; AMinute: Word; ASecond: Word; AMilliSecond: Word): Double;
  static function EncodeDateWeek(AYear: Word; AWeekOfYear: Word; ADayOfWeek: Word): Double;
  static function EncodeDayOfWeekInMonth(AYear: Word; AMonth: Word; ANthDayOfWeek: Word; ADayOfWeek: Word): Double;
  static function EndOfADay(AYear: Word; ADayOfYear: Word): Double; overload;
  static function EndOfADay(AYear: Word; AMonth: Word; ADay: Word): Double; overload;
  static function EndOfAMonth(AYear: Word; AMonth: Word): Double;
  static function EndOfAWeek(AYear: Word; AWeekOfYear: Word; ADayOfWeek: Word): Double;
  static function EndOfAYear(AYear: Word): Double;
  static function EndOfTheDay(AValue: Double): Double;
  static function EndOfTheMonth(AValue: Double): Double;
  static function EndOfTheWeek(AValue: Double): Double;
  static function EndOfTheYear(AValue: Double): Double;
  static function HourOf(AValue: Double): Word;
  static function HourOfTheDay(AValue: Double): Word;
  static function HourOfTheMonth(AValue: Double): Word;
  static function HourOfTheWeek(AValue: Double): Word;
  static function HourOfTheYear(AValue: Double): Word;
  static function HoursBetween(ANow: Double; AThen: Double): Int64;
  static function HourSpan(ANow: Double; AThen: Double): Double;
  static function IncDay(AValue: Double; ANumberOfDays: Longint): Double;
  static function IncHour(AValue: Double; ANumberOfHours: Int64): Double;
  static function IncMilliSecond(AValue: Double; ANumberOfMilliSeconds: Int64): Double;
  static function IncMinute(AValue: Double; ANumberOfMinutes: Int64): Double;
  static function IncSecond(AValue: Double; ANumberOfSeconds: Int64): Double;
  static function IncWeek(AValue: Double; ANumberOfWeeks: Longint): Double;
  static function IncYear(AValue: Double; ANumberOfYears: Longint): Double;
  static procedure InvalidDateDayError(AYear: Word; ADayOfYear: Word);
  static procedure InvalidDateMonthWeekError(AYear: Word; AMonth: Word; AWeekOfMonth: Word; ADayOfWeek: Word);
  static procedure InvalidDateTimeError(AYear: Word; AMonth: Word; ADay: Word; AHour: Word; AMinute: Word; ASecond: Word; AMilliSecond: Word; ABaseDate: Double);
  static procedure InvalidDateWeekError(AYear: Word; AWeekOfYear: Word; ADayOfWeek: Word);
  static procedure InvalidDayOfWeekInMonthError(AYear: Word; AMonth: Word; ANthDayOfWeek: Word; ADayOfWeek: Word);
  static function IsInLeapYear(AValue: Double): Boolean;
  static function IsPM(AValue: Double): Boolean;
  static function IsSameDay(AValue: Double; ABasis: Double): Boolean;
  static function IsToday(AValue: Double): Boolean;
  static function IsValidDate(AYear: Word; AMonth: Word; ADay: Word): Boolean;
  static function IsValidDateDay(AYear: Word; ADayOfYear: Word): Boolean;
  static function IsValidDateMonthWeek(AYear: Word; AMonth: Word; AWeekOfMonth: Word; ADayOfWeek: Word): Boolean;
  static function IsValidDateTime(AYear: Word; AMonth: Word; ADay: Word; AHour: Word; AMinute: Word; ASecond: Word; AMilliSecond: Word): Boolean;
  static function IsValidDateWeek(AYear: Word; AWeekOfYear: Word; ADayOfWeek: Word): Boolean;
  static function IsValidTime(AHour: Word; AMinute: Word; ASecond: Word; AMilliSecond: Word): Boolean;
  static function JulianDateToDateTime(AValue: Double): Double;
  static function MilliSecondOf(AValue: Double): Word;
  static function MilliSecondOfTheDay(AValue: Double): Longword;
  static function MilliSecondOfTheHour(AValue: Double): Longword;
  static function MilliSecondOfTheMinute(AValue: Double): Longword;
  static function MilliSecondOfTheMonth(AValue: Double): Longword;
  static function MilliSecondOfTheSecond(AValue: Double): Word;
  static function MilliSecondOfTheWeek(AValue: Double): Longword;
  static function MilliSecondOfTheYear(AValue: Double): Int64;
  static function MilliSecondsBetween(ANow: Double; AThen: Double): Int64;
  static function MilliSecondSpan(ANow: Double; AThen: Double): Double;
  static function MinuteOf(AValue: Double): Word;
  static function MinuteOfTheDay(AValue: Double): Word;
  static function MinuteOfTheHour(AValue: Double): Word;
  static function MinuteOfTheMonth(AValue: Double): Word;
  static function MinuteOfTheWeek(AValue: Double): Word;
  static function MinuteOfTheYear(AValue: Double): Longword;
  static function MinutesBetween(ANow: Double; AThen: Double): Int64;
  static function MinuteSpan(ANow: Double; AThen: Double): Double;
  static function ModifiedJulianDateToDateTime(AValue: Double): Double;
  static function MonthOf(AValue: Double): Word;
  static function MonthOfTheYear(AValue: Double): Word;
  static function MonthsBetween(ANow: Double; AThen: Double): Longint;
  static function MonthSpan(ANow: Double; AThen: Double): Double;
  static function NthDayOfWeek(AValue: Double): Word;
  static function RecodeDate(AValue: Double; AYear: Word; AMonth: Word; ADay: Word): Double;
  static function RecodeDateTime(AValue: Double; AYear: Word; AMonth: Word; ADay: Word; AHour: Word; AMinute: Word; ASecond: Word; AMilliSecond: Word): Double;
  static function RecodeDay(AValue: Double; ADay: Word): Double;
  static function RecodeHour(AValue: Double; AHour: Word): Double;
  static function RecodeMilliSecond(AValue: Double; AMilliSecond: Word): Double;
  static function RecodeMinute(AValue: Double; AMinute: Word): Double;
  static function RecodeMonth(AValue: Double; AMonth: Word): Double;
  static function RecodeSecond(AValue: Double; ASecond: Word): Double;
  static function RecodeTime(AValue: Double; AHour: Word; AMinute: Word; ASecond: Word; AMilliSecond: Word): Double;
  static function RecodeYear(AValue: Double; AYear: Word): Double;
  static function SameDate(A: Double; B: Double): Boolean;
  static function SameDateTime(A: Double; B: Double): Boolean;
  static function SameTime(A: Double; B: Double): Boolean;
  static function SecondOf(AValue: Double): Word;
  static function SecondOfTheDay(AValue: Double): Longword;
  static function SecondOfTheHour(AValue: Double): Word;
  static function SecondOfTheMinute(AValue: Double): Word;
  static function SecondOfTheMonth(AValue: Double): Longword;
  static function SecondOfTheWeek(AValue: Double): Longword;
  static function SecondOfTheYear(AValue: Double): Longword;
  static function SecondsBetween(ANow: Double; AThen: Double): Int64;
  static function SecondSpan(ANow: Double; AThen: Double): Double;
  static function StartOfADay(AYear: Word; ADayOfYear: Word): Double; overload;
  static function StartOfADay(AYear: Word; AMonth: Word; ADay: Word): Double; overload;
  static function StartOfAMonth(AYear: Word; AMonth: Word): Double;
  static function StartOfAWeek(AYear: Word; AWeekOfYear: Word; ADayOfWeek: Word): Double;
  static function StartOfAYear(AYear: Word): Double;
  static function StartOfTheDay(AValue: Double): Double;
  static function StartOfTheMonth(AValue: Double): Double;
  static function StartOfTheWeek(AValue: Double): Double;
  static function StartOfTheYear(AValue: Double): Double;
  static function TimeOf(AValue: Double): Double;
  static function Today: Double;
  static function Tomorrow: Double;
  static function TryEncodeDateDay(AYear: Word; ADayOfYear: Word; AValue: Double): Boolean;
  static function TryEncodeDateMonthWeek(AYear: Word; AMonth: Word; AWeekOfMonth: Word; ADayOfWeek: Word; AValue: Double): Boolean;
  static function TryEncodeDateTime(AYear: Word; AMonth: Word; ADay: Word; AHour: Word; AMinute: Word; ASecond: Word; AMilliSecond: Word; AValue: Double): Boolean;
  static function TryEncodeDateWeek(AYear: Word; AWeekOfYear: Word; AValue: Double; ADayOfWeek: Word): Boolean;
  static function TryEncodeDayOfWeekInMonth(AYear: Word; AMonth: Word; ANthDayOfWeek: Word; ADayOfWeek: Word; AValue: Double): Boolean;
  static function TryJulianDateToDateTime(AValue: Double; ADateTime: Double): Boolean;
  static function TryModifiedJulianDateToDateTime(AValue: Double; ADateTime: Double): Boolean;
  static function TryRecodeDateTime(AValue: Double; AYear: Word; AMonth: Word; ADay: Word; AHour: Word; AMinute: Word; ASecond: Word; AMilliSecond: Word; AResult: Double): Boolean;
  static function UnixToDateTime(AValue: Int64): Double;
  static function WeekOf(AValue: Double): Word;
  static function WeekOfTheMonth(AValue: Double; AYear: Word; AMonth: Word): Word; overload;
  static function WeekOfTheMonth(AValue: Double): Word; overload;
  static function WeekOfTheYear(AValue: Double): Word; overload;
  static function WeekOfTheYear(AValue: Double; AYear: Word): Word; overload;
  static function WeeksBetween(ANow: Double; AThen: Double): Longint;
  static function WeeksInAYear(AYear: Word): Word;
  static function WeeksInYear(AValue: Double): Word;
  static function WeekSpan(ANow: Double; AThen: Double): Double;
  static function WithinPastDays(ANow: Double; AThen: Double; ADays: Longint): Boolean;
  static function WithinPastHours(ANow: Double; AThen: Double; AHours: Int64): Boolean;
  static function WithinPastMilliSeconds(ANow: Double; AThen: Double; AMilliSeconds: Int64): Boolean;
  static function WithinPastMinutes(ANow: Double; AThen: Double; AMinutes: Int64): Boolean;
  static function WithinPastMonths(ANow: Double; AThen: Double; AMonths: Longint): Boolean;
  static function WithinPastSeconds(ANow: Double; AThen: Double; ASeconds: Int64): Boolean;
  static function WithinPastWeeks(ANow: Double; AThen: Double; AWeeks: Longint): Boolean;
  static function WithinPastYears(ANow: Double; AThen: Double; AYears: Longint): Boolean;
  static function YearOf(AValue: Double): Word;
  static function YearsBetween(ANow: Double; AThen: Double): Longint;
  static function YearSpan(ANow: Double; AThen: Double): Double;
  static function Yesterday: Double;
  property ApproxDaysPerMonth: Double;
  property ApproxDaysPerYear: Double;
end;
回复 支持 反对

使用道具 举报

发表于 2007-5-15 10:12:34 | 显示全部楼层
请问你是怎么找的?
首先你要知道函数的名字吧,例如小时差为HoursBetween(),周差为WeeksBetween()
然后用这个去搜,这些函数在哪里,经过搜索在 Business.System.DateUtils 这里
回复 支持 反对

使用道具 举报

发表于 2007-5-15 10:19:17 | 显示全部楼层
另外在Sysutils,DateUtils,StringUtils,FileUtils,JSSysUtils几个单元下也有我们常用的一些函数
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-5-15 12:43:54 | 显示全部楼层
额。。。失误。。我用中文查的,,,现在找到了,
回复 支持 反对

使用道具 举报

发表于 2007-5-15 13:57:48 | 显示全部楼层
ok,结贴了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-7-8 13:58 , Processed in 0.040388 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表