用什么函数可以直接读取当前时间?

解决方案 »

  1.   

    formatdatetime('yyyy'-'mm',当前时间)
      

  2.   

    Date;//日期
    Time;//时间
    Now;//日期加时间;
    以上三个全部是函数真接用就行了!
      

  3.   

    CheckSqlTimeStamp procedureChecks whether a TSQLTimeStamp value represents a valid date and time.CompareDate functionIndicates the relationship between the date portions of two TDateTime values.CompareDateTime functionIndicates the relationship between two TDateTime values.CompareTime functionIndicates the relationship between the time portions of two TDateTime values.CurrentYear functionReturns the current year.Date functionReturns the current date.DateDelta constantSpecifies the difference between TDateTime and TTimeStamp values.DateOf functionStrips the time portion from a TDateTime value.DateTimeToFileDate functionConverts a TDateTime object to an OS timestamp.DateTimeToSQLTimeStamp functionConverts a TDateTime value to a TSQLTimeStamp value.DateTimeToStr functionConverts a TDateTime value to a string.DateTimeToString procedureConverts a TDateTime value to a string using a specified Format.DateTimeToSystemTime procedureConverts a TDateTime value into the Win32 API's system time type.DateTimeToTimeStamp functionConverts a TDateTime value into the corresponding TTimeStamp value.DateToStr functionConverts a TDateTime value to a string.Day of week constantsProvide symbolic constants for ISO 8601-compliant day of the week values.DayOf functionReturns the day of the month represented by a TDateTime value.DayOfTheMonth functionReturns the day of the month represented by a TDateTime value.DayOfTheWeek functionReturns the day of the week represented by a TDateTime value.DayOfTheYear functionReturns the number of days between a specified TDateTime value and December 31 of the previous year.DayOfWeek functionReturns the day of the week for a specified date.DaysBetween functionReturns the number of whole days between two specified TDateTime values.DaysInAMonth functionReturns the number of days in a specified month of a specified year.DaysInAYear functionReturns the number of days in a specified year.DaysInMonth functionReturns the number of days in the month of a specified TDateTime value.DaysInYear functionReturns the number of days in the year of a specified TDateTime value.DaySpan functionReturns the number of days (including fractional days) between two specified TDateTime values.DecodeDate procedureReturns Year, Month, and Day values for a TDateTime value.DecodeDateDay procedureReturns the year and day of the year for a specified TDateTime.DecodeDateFully functionReturns Year, Month, and Day, and Day-of-Week values for a TDateTime value.DecodeDateMonthWeek procedureReturns the year, month, week of the month, and day of the week for a specified TDateTime.DecodeDateTime procedureReturns Year, Month, Day, Hour, Minute, Second, and Millisecond values for a TDateTime.DecodeDateWeek procedureReturns the year, week of the year, and day of the week for a specified TDateTime value.DecodeDayOfWeekInMonth procedureFor a given TDateTime value, returns the year, month, day of the week, and the count of that day of the week in the month.DecodeTime procedureBreaks a TDateTime value into hours, minutes, seconds, and milliseconds.EncodeDate function functionReturns a TDateTime value that represents a specified Year, Month, and Day.EncodeDateDay functionReturns a TDateTime that represents a specified day of the year for a specified year.EncodeDateMonthWeek functionReturns a TDateTime that represents a specified day of a specified week in a specified month and year.EncodeDateTime functionReturns a TDateTime that represents a specified year, month, day, hour, minute, second, and millisecond.EncodeDateWeek functionReturns a TDateTime that represents a specified day of a specified week in a specified year.EncodeDayOfWeekInMonth functionReturns a TDateTime that represents a specified occurrence of a day of the week within a specified month and year.EncodeTime functionReturns a TDateTime value for a specified Hour, Min, Sec, and MSec.EndOfADay functionReturns a TDateTime that represents the last millisecond of a specified day.EndOfAMonth functionReturns a TDateTime that represents the last millisecond of the last day of a specified month.EndOfAWeek functionReturns a TDateTime value that represents the last millisecond of a specified day of a specified week.EndOfAYear functionReturns a TDateTime that represents the last millisecond of a specified year.EndOfTheDay functionReturns a TDateTime that represents the last millisecond of the day identified by a specified TDateTime.EndOfTheMonth functionReturns a TDateTime that represents the last millisecond of the last day of the month identified by a specified TDateTime.EndOfTheWeek functionReturns a TDateTime that represents the last millisecond of the last day of the week identified by a specified TDateTime.EndOfTheYear functionReturns a TDateTime that represents the last millisecond of the last day of the year identified by a specified TDateTime.FormatDateTime functionFormats a TDateTime value.HourOf functionReturns the hour of the day represented by a TDateTime value.HourOfTheDay functionReturns the hour of the day represented by a TDateTime value.HourOfTheMonth functionReturns the number of hours between a specified TDateTime value and 12:00 AM of the first day of the month.HourOfTheWeek functionReturns the number of hours between a specified TDateTime value and 12:00 AM of the first day of the week.HourOfTheYear functionReturns the number of hours between a specified TDateTime value and 12:00 AM of the first day of the year.HoursBetween functionReturns the number of whole hours between two specified TDateTime values.HourSpan functionReturns the number of Hours (including fractional Hours) between two specified TDateTime values.IncAMonth procedureIncrements date data by one month.IncDay functionReturns a date shifted by a specified number of days.IncHour functionReturns a date/time value shifted by a specified number of hours.IncMilliSecond functionReturns a date/time value shifted by a specified number of milliseconds.IncMinute functionReturns a date/time value shifted by a specified number of minutes.IncMonth functionReturns a date shifted by a specified number of months.IncSecond functionReturns a date/time value shifted by a specified number of seconds.IncWeek functionReturns a date shifted by a specified number of weeks.IncYear functionReturns a date shifted by a specified number of years.IsInLeapYear functionIndicates whether a specified TDateTime value occurs in a leap year.IsLeapYear functionIndicates whether a specified year is a leap year.IsPM functionIndicates whether the time portion of a specified TDateTime value occurs after noon.IsSameDay functionIndicates whether a specified TDateTime value occurs on a the same day as a criterion date.IsToday functionIndicates whether a specified TDateTime value occurs on the current date.IsValidDate functionIndicates whether a specified year, month, and day represent a valid date.
      

  4.   

    IsValidDateDay functionIndicates whether a specified year and day of the year represent a valid date.IsValidDateMonthWeek functionIndicates whether a specified year, month, week of the month, and day of the week represent a valid date.IsValidDateTime functionIndicates whether a specified year, month, day, hour, minute, second, and millisecond represent a valid date and time.IsValidDateWeek functionIndicates whether a specified year, week of the year, and day of the week represent a valid date.IsValidTime functionIndicates whether a specified hour, minute, second, and millisecond represent a valid date and time.MilliSecondOf functionReturns the millisecond of the second represented by a TDateTime value.MilliSecondOfTheDay functionReturns the number of milliseconds between a specified TDateTime value and the beginning of the same day.MilliSecondOfTheHour functionReturns the number of milliseconds between a specified TDateTime value and the beginning of the same hour.MilliSecondOfTheMinute functionReturns the number of milliseconds between a specified TDateTime value and the beginning of the same minute.MilliSecondOfTheMonth functionReturns the number of milliseconds between a specified TDateTime value and the beginning of the month.MilliSecondOfTheSecond functionReturns the millisecond of the second represented by a TDateTime value.MilliSecondOfTheWeek functionReturns the number of milliseconds between a specified TDateTime value and 12:00:00:00 AM of the first day of the week.MilliSecondOfTheYear functionReturns the number of milliseconds between a specified TDateTime value and 12:00:00:00 AM of the first day of the year.MilliSecondsBetween functionReturns the number of milliseconds between two specified TDateTime values.MilliSecondSpan functionReturns the number of milliseconds between two specified TDateTime values.MinuteOf functionReturns the minute of the hour represented by a TDateTime value.MinuteOfTheDay functionReturns the number of minutes between a specified TDateTime value and 12:00 AM of the same day.MinuteOfTheHour functionReturns the number of minutes between a specified TDateTime value and the beginning of the same hour.MinuteOfTheMonth functionReturns the number of minutes between a specified TDateTime value and 12:00 AM of the first day of the month.MinuteOfTheWeek functionReturns the number of minutes between a specified TDateTime value and 12:00 AM of the first day of the week.MinuteOfTheYear functionReturns the number of minutes between a specified TDateTime value and 12:00 AM of the first day of the year.MinutesBetween functionReturns the number of minutes between two specified TDateTime values.MinuteSpan functionReturns the number of minutes, including fractions thereof, between two specified TDateTime values.MonthOf functionReturns the month of the year represented by a TDateTime value.MonthOfTheYear functionReturns the month of the year represented by a TDateTime value.MonthsBetween functionReturns the approximate number of months between two specified TDateTime values.MonthSpan functionReturns the approximate number of months, including fractions, between two specified TDateTime values.MSecsToTimeStamp functionConverts a specified number of milliseconds into a TTimeStamp value.Now functionReturns the current date and time.NthDayOfWeek functionReturns which occurrence of its weekday a specified TDateTime value represents.NullSQLTimeStamp constantRepresents a NULL TSQLTimeStamp value.OneHour Constant;OneMillisecond Constant;OneMinute Constant;OneSecond ConstantDelphi inverse time unit constants.RecodeDate functionReplaces the date portion of a specified TDateTime value.RecodeDateTime functionSelectively replaces parts of a specified TDateTime value.RecodeDay functionReplaces the day of the month for a specified TDateTime value.RecodeHour functionReplaces the hour of the day for a specified TDateTime value.RecodeMilliSecond functionReplaces the millisecond of the second for a specified TDateTime value.RecodeMinute functionReplaces the minute of the hour for a specified TDateTime value.RecodeMonth functionReplaces the month of the year for a specified TDateTime value.RecodeSecond functionReplaces the second of the minute for a specified TDateTime value.RecodeTime functionReplaces the time portion of a specified TDateTime value.RecodeYear functionReplaces the year for a specified TDateTime value.ReplaceDate procedureReplaces the date portion of a TDateTime value with a specified date.ReplaceTime procedureReplaces the time portion of a TDateTime value with a specified time.SameDate functionIndicates whether two TDateTime values represent the same year, month, and day.SameDateTime functionIndicates whether two TDateTime values represent the same year, month, day, hour, minute, second, and millisecond.SameTime functionIndicates whether two TDateTime values represent the same time of day, ignoring the date portion.SecondOf functionReturns the second of the minute represented by a TDateTime value.SecondOfTheDay functionReturns the number of seconds between a specified TDateTime value and 12:00:00 AM of the same day.SecondOfTheHour functionReturns the number of seconds between a specified TDateTime value and the beginning of the same hour.
      

  5.   

    SecondOfTheMinute functionReturns the number of seconds between a specified TDateTime value and the beginning of the same minute.SecondOfTheMonth functionReturns the number of seconds between a specified TDateTime value and 12:00:00 AM on the first day of the month.SecondOfTheWeek functionReturns the number of seconds between a specified TDateTime value and 12:00:00 AM of the first day of the week.SecondOfTheYear functionReturns the number of seconds between a specified TDateTime value and 12:00:00 AM on the first day of the year.SecondsBetween functionReturns the number of seconds between two specified TDateTime values.SecondSpan functionReturns the number of seconds (including fractions thereof) between two specified TDateTime values.SQLDayOfWeek functionIndicates the day of the week when a specified TSQLTimeStamp value occurs.SQLTimeStampToDateTime functionConverts a TSQLTimeStamp value to a TDateTime value.SQLTimeStampToStr functionConverts a TSQLTimeStamp value to a string.StartOfADay functionReturns a TDateTime that represents 12:00:00:00 AM on a specified day.StartOfAMonth functionReturns a TDateTime that represents 12:00:00:00 AM on the first day of a specified month.StartOfAWeek functionReturns a TDateTime that represents 1the first moment on a specified day of a specified week.StartOfAYear functionReturns a TDateTime that represents the first moment on the first day of a specified year.StartOfTheDay functionReturns a TDateTime that represents 12:00:00:00 AM on the day identified by a specified TDateTime.StartOfTheMonth functionReturns a TDateTime that represents 12:00:00:00 AM on the first day of the month identified by a specified TDateTime.StartOfTheWeek functionReturns a TDateTime that represents 12:00:00:00 AM on the first day of the week identified by a specified TDateTime.StartOfTheYear functionReturns a TDateTime that represents 12:00:00:00 AM on the first day of the year identified by a specified TDateTime.StrToDate functionConverts a string to a TDateTime value.StrToDateDef functionConverts a string to a TDateTime value, with error default.StrToDateTime functionConverts a string to a TDateTime value.StrToDateTimeDef functionConverts a string to a TDateTime value with error default.StrToSQLTimeStamp functionConverts a string to a TSQLTimeStamp value.StrToTime functionConverts a string to a TDateTime value.StrToTimeDef functionConverts a string to a TDateTime value with error default.SystemTimeToDateTime functionConverts a system time value into a TDateTime value.Time unit constantsRepresent useful values for time calculations.Time, GetTime functionsReturns the current time.TimeOf functionStrips the date portion from a TDateTime value.TimeStampToDateTime functionConverts a TTimeStamp value into the corresponding TDateTime value.TimeStampToMSecs functionConverts a TTimeStamp value into an absolute number of milliseconds.TimeToStr functionReturns a string that represents a TDateTime value.Today functionReturns a TDateTime value that represents the current date.Tomorrow functionReturns a TDateTime value that represents the following day.TryEncodeDate functionCreates a TDateTime value that represents a specified Year, Month, and Day.TryEncodeDateDay functionCalculates the TDateTime value that represents a specified day of the year for a specified year.TryEncodeDateMonthWeek functionCalculates the TDateTime value that represents a specified day of a specified week in a specified month and year.TryEncodeDateTime functionCalculates the TDateTime value that represents a specified year, month, day, hour, minute, second, and millisecond.TryEncodeDateWeek functionCalculates the TDateTime value that represents a specified day of a specified week in a specified year.TryEncodeDayOfWeekInMonth functionCalculates a TDateTime that represents a specified occurrence of a day of the week within a specified month and year.TryEncodeTime functionCreates a TDateTime value for a specified Hour, Min, Sec, and MSec.TryRecodeDateTime functionSelectively replaces parts of a specified TDateTime value.TryStrToDate functionConverts a string to a TDateTime value, with a Boolean success code.TryStrToDateTime functionConverts a string to a TDateTime value with a Boolean success code.TryStrToSQLTimeStamp functionConverts a string to a TSQLTimeStamp value.TryStrToTime functionConverts a string to a TDateTime value with an error default.UnixDateDelta constantSpecifies the difference between TDateTime and TIME_T values.WeekOf functionReturns the week of the year represented by a TDateTime value.WeekOfTheMonth functionReturns the week of the month represented by a TDateTime value.WeekOfTheYear functionReturns the week of the year represented by a TDateTime value.WeeksBetween functionReturns the number of whole weeks between two specified TDateTime values.WeeksInAYear functionReturns the number of weeks in a specified year.WeeksInYear functionReturns the number of weeks in the year of a specified TDateTime value.WeekSpan functionReturns the number of weeks (including fractional weeks) between two specified TDateTime values.WithinPastDays functionIndicates whether two dates are within a specified number of days of each other.WithinPastHours functionIndicates whether two date/time values are within a specified number of hours of each other.WithinPastMilliSeconds functionIndicates whether two date/time values are within a specified number of milliseconds of each other.WithinPastMinutes functionIndicates whether two date/time values are within a specified number of minutes of each other.WithinPastMonths functionIndicates whether two date/time values are within a specified number of months of each other.WithinPastSeconds functionIndicates whether two date/time values are within a specified number of seconds of each other.WithinPastWeeks functionIndicates whether two date/time values are within a specified number of weeks of each other.WithinPastYears functionIndicates whether two date/time values are within a specified number of years of each other.YearOf functionReturns the year represented by a TDateTime value.YearsBetween functionReturns the approximate number of years between two specified TDateTime values.YearSpan functionReturns the approximate number of years (including fractions thereof) between two specified TDateTime values.Yesterday functionReturns a TDateTime value that represents the preceding day
      

  6.   

    时间:
    formatdatetime('hh:mm:dd',time());