Advantage Database Server - Tools: AdsExtra
Table of contents:
Introduction
Unit AdsExtra
Usage conditions
Download of the Unit
History
Introduction
The unit AdsExtra contain any functions for convert date, time and float values without trouble because different locale settings.
ACE mean Advantage Client Engine.
Sorry for my english, I have never learn this language.
Unit AdsExtra
ACE date format
function AdsDelphiDateFormat: String; |
The function get the current date format from ACE and convert this to Delphi's Date Format. |
function AdsGetLocalAdsDateFormat: String; |
The function convert the current ShortDateFormat to a valid ACE date format. The function change not the ACE date format. |
Date and time with ACE
function AdsDateToStr(AValue: TDateTime): String; |
The function convert a TDateTime value to a date string formated with the current ACE date format. Use this for filter functions. |
function AdsTimeToStr(AValue: TDateTime): String; |
The function convert a TDateTime value to a time string formated with the ACE time format. Use this for filter functions. |
function AdsDateTimeToStr(AValue: TDateTime): String; |
The function convert a TDateTime value to a timestamp string formated with the current ACE date and time format. Use this for filter functions. |
Date and time with SQL-92
function AdsSQLDateToStr(AValue: TDateTime): String; |
The function convert a TDateTime value to a date string formated in SQL-92 format. Use this for SQL statements. |
function AdsSQLTimeToStr(AValue: TDateTime): String; |
The function convert a TDateTime value to a time string formated in SQL-92 format. Use this for SQL statements. |
function AdsSQLDateTimeToStr(AValue: TDateTime): String; |
The function convert a TDateTime value to a timestamp string formated in SQL-92 format. Use this for SQL statements. |
function AdsSQLStrToDate(const AValue: String): TDateTime; |
The function convert a date string formated in SQL-92 format (CCYY-MM-DD or CCYYMMDD) to a TDateTime value. |
function AdsSQLStrToTime(const AValue: String): TDateTime; |
The function convert a time string formated in SQL-92 format (hh:mm:ss.z, hhmmss.z, hh:mm and hhmm) to a TDateTime value. |
function AdsSQLStrToDateTime(const AValue: String): TDateTime; |
The function convert a timestamp string formated in SQL-92 format to a TDateTime value. The format contain a date string and a time string separated with a space. |
Float with ACE and SQL
function AdsFloatToStr(AValue: Extended): String; |
The function convert a float value to a float string in ACE format (decimalseparator = '.'). Use this for filter functions and SQL statements. |
function AdsStrToFloat(const AValue: String): Extended; |
The function convert a float string in ACE format (decimalseparator = '.') to a float value. |
Date and time convert functions for direct access to ACE.
function DateToChronicalJulianDay(ADate: TDateTime): DWord; |
The function convert a TDateTime value to a Chronical Julian Day. Use this function for set a date field value with ACE.AdsSetJulian. |
function ChronicalJulianDayToDate(ADate: DWord): TDateTime; |
The function convert a Chronical Julian Day to a TDateTime value. Use this function for get a date field value with ACE.AdsGetJulian. |
function TimeToMilliseconds(ATime: TDateTime): DWord; |
The function convert a TDateTime value to a DWord value (Milliseconds since midnight). Use this function for set a time field value with ACE.AdsSetMilliseconds. |
function MillisecondsToTime(ATime: DWord): TDateTime; |
The function convert a DWord value (Milliseconds since midnight) to a TDateTime value. Use this function for get a time field value with ACE.AdsGetMilliseconds. |
Constants for date and time conversion
const
AdsDelphiTimeFormat = 'hh":"nn":"ss AM/PM'; |
The constant contain the time formatstring for the ACE time format. |
const
AdsSQLDelphiDateFormat = 'YYYY"-"MM"-"DD'; |
The constant contain the date formatstring for the SQL-92 date format. |
const
AdsSQLDelphiTimeFormat = 'hh":"nn":"ss"."z'; |
The constant contain the time formatstring for the SQL-92 time format. |
const
AdsSQLDelphiDateTimeFormat = 'YYYY"-"MM"-"DD hh":"nn":"ss"."z'; |
The constant contain the timestamp formatstring for the SQL-92 timestamp format. |
const
ChronicalJulianDayDelta = DateDelta + 1721425; |
The constant contain the offset between a TDateTime value and the corresponding Chronical Julian Day value. ADS use Chronical Julian Day values for storing the date values. |
Usage conditions
The contents of units are subject to the Mozilla Public License Version 1.0.
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Download of the Unit
Download the units as zip file (4 kByte)
History
2000-11-23 |
- Version 1.0
- First public version
|
2000-12-31 |
- Version 1.1
- add DateToChronicalJulianDay, ChronicalJulianDayToDate
- add TimeToMilliseconds, MillisecondsToTime
|
2001-01-17 |
- Version 1.2
- add AdsSetDelphiDateFormat, AdsGetLocalAdsDateFormat
- add EACEError, ACECheck
|