请问如何在程序中修改ACCESS数据库中日期/时间字断的格式(要求改成:长时间) (50分)

Z

zhem8

Unregistered / Unconfirmed
GUEST, unregistred user!
ACCESS数据库中日期/时间字段 的格式分为:
1 常规日期 1994-6-19 17:34:23
2 长日期 94年6月19日
3 中日期 94-06-19
4 短日期 94-6-19
5 长时间 17:34:23
6 中时间 5:34
7 短时间 17:34
我要在程序中修改ACCESS数据库中修改某一日期/时间字段的格式。要求将该字段该成:长时间格式
我不想用Formatdatetime,timevalue 这些函数,因为不符合我的要求
因为牵涉到后面的报表打印,我觉得最好就是在程序中修改字段格式
请问怎么做?
 
没看懂,举个例子?
 
在控制面板的区域里面改。
 
to ego
我要求在程序里修改!
 
设置它的格式
 
to jsxjd:
你能说的具体点吗?在程序里怎么写?
 
Currency and date/time formatting variables

See also Example
Influence the way numeric or date/time values are formatted.

Unit

Sysutils

The following are a set of variables used to define the format for numeric or date/time strings:

var CurrencyString: string;
var CurrencyFormat: Byte;
var NegCurrFormat: Byte;
var ThousandSeparator: Char;
var DecimalSeparator: Char;
var CurrencyDecimals: Byte;
var DateSeparator: Char;
var ShortDateFormat: string;
var LongDateFormat: string;
var TimeSeparator: Char;
var TimeAMString: string;
var TimePMString: string;
var ShortTimeFormat: string;

var LongTimeFormat: string;
var ShortMonthNames: array[1..12] of string;
var LongMonthNames: array[1..12] of string;
var ShortDayNames: array[1..7] of string;
var LongDayNames: array[1..7] of string;

var SysLocale: TSysLocale;
var EraNames: array[1..7] of string;
var EraYearOffsets: array[1..7] of Integer;
var TwoDigitYearCenturyWindow: Word = 50;

var TListSeparator: Char;

Description

The Sysutils unit includes a number of variables that are used by various
formatting routines. Values are assigned to these variables to define the
formats of numeric and date/time strings. The initial values of these variables
are fetched from the system registry using the GetLocaleInfo function in the
Win32 API. VCL (non-console) applications automatically update these formatting
variables in response to WM_WININICHANGE messages. The Application variable抯
UpdateFormatSettings method either allows or disallows changes in system
settings. The default is True. Set this property to False to prevent the system
settings from changing.

The description of each variable specifies the LOCALE_XXXX constant used to
fetch the initial value using the GetLocaleInfo Win32 API.

Typed constant Defines

CurrencyString CurrencyString defines the currency symbol (or characters)
used in floating-point to decimal conversions. The initial value is fetched
from LOCALE_SCURRENCY.
CurrencyFormat CurrencyFormat defines the currency symbol placement and
separation used in floating-point杢o杁ecimal conversions. Possible values are:

0 = $1
1 = 1$
2 = $ 1
3 = 1 $
The initial value is fetched from LOCALE_ICURRENCY.
NegCurrFormat NegCurrFormat defines the currency format used in
floating-point to decimal conversions of negative numbers. Possible values are:

0 = ($1) 4 = (1$) 8 = -1 $ 12 = $ -1
1 = -$1 5 = -1$ 9 = -$ 1 13 = 1- $
2 = $-1 6 = 1-$ 10 = 1 $- 14 = ($ 1)
3 = $1- 7 = 1$- 11 = $ 1- 15 = (1 $)
The initial value is fetched from LOCALE_INEGCURR.

ThousandSeparator ThousandSeparator is the character used to separate
thousands in numbers with more than three digits to the left of the decimal
separator. The initial value is fetched from LOCALE_STHOUSAND.
DecimalSeparator DecimalSeparator is the character used to separate
the integer part from the fractional part of a number. The initial value is
fetched from LOCALE_SDECIMAL.
CurrencyDecimals CurrencyDecimals is the number of digits to the right
of the decimal point in a currency amount. The initial value is fetched from
LOCALE_ICURRDIGITS.

DateSeparator DateSeparator is the character used to separate the year,
month, and day parts of a date value. The initial value is fetched from
LOCATE_SDATE.
ShortDateFormat ShortDateFormat is the format string used to convert
a date value to a short string suitable for editing. For a complete description
of date and time format strings, see the documentation for the
FormatDateTime function. The short date format should only use the date
separator character and the m, mm, d, dd, yy, and yyyy format specifiers.
The initial value is fetched from LOCALE_SSHORTDATE..

LongDateFormat LongDateFormat is the format string used to convert a
date value to a long string suitable for display but not for editing. For
a complete description of date and time format strings, see the documentation
for the FormatDateTime function. The initial value is fetched from
LOCALE_SLONGDATE.
TimeSeparator TimeSeparator is the character used to separate the hour,
minute, and second parts of a time value. The initial value is fetched from
LOCALE_STIME.

TimeAMString TimeAMString is the suffix string used for time values
between 00:00 and 11:59 in 12-hour clock format. The initial value is fetched
from LOCALE_S1159.
TimePMString TimePMString is the suffix string used for time values
between 12:00 and 23:59 in 12-hour clock format. The initial value is fetched
from LOCALE_S2359.
ShortTimeFormat ShortTimeFormat is the format string used to convert a
time value to a short string with only hours and minutes. The default value is
computed from LOCALE_ITIME and LOCALE_ITLZERO.

LongTimeFormat LongTimeFormat is the format string used to convert a
time value to a long string with hours, minutes, and seconds. The default
value is computed from LOCALE_ITIME and LOCALE_ITLZERO.
ShortMonthNames ShortMonthNames is the array of strings containing short
month names. The mmm format specifier in a format string passed to
FormatDateTime causes a short month name to be substituted. The default
values are fetched from the LOCALE_SABBREVMONTHNAME system locale entries.

LongMonthNames LongMonthNames is the array of strings containing long
month names. The mmmm format specifier in a format string passed to
FormatDateTime causes a long month name to be substituted. The default values
are fetched from the LOCALE_SMONTHNAME system locale entries.
ShortDayNames ShortDayNames is the array of strings containing short
day names. The ddd format specifier in a format string passed to
FormatDateTime causes a short day name to be substituted. The default values
are fetched from the LOCALE_SABBREVDAYNAME system locale entries.

LongDayNames LongDayNames is the array of strings containing long
day names. The dddd format specifier in a format string passed to
FormatDateTime causes a long day name to be substituted. The default values
are fetched from the LOCALE_SDAYNAME system locale entries.
SysLocale Indicates the locale used by FormatDateTime to interpret dates.
EraName Controls the DateTimeToStr function (for East Asian locales).

EraYearOffsets Controls the DateTimeToStr function (for East Asian locales).
TwoDigitYearCenturyWindow Determines what century is added to two-digit
years when string dates are converted to numeric dates with StrToDate or
StrToDateTime. The value of TwoDigitYearCenturyWindow, if it is nonzero, is
subtracted from the current year to calculate the floating 損ivot?prior to
which two-digit years are interpreted as falling in the next century.
The default value is 50. You can use TwoDigitYearCenturyWindow to extend the
life of legacy applications that are tied to two-digit-year data entry; but
the best solution is to require four-digit input for years.

ListSeparator The character used to separate items in a list. The
default value is fetched from LOCALE_SLIST.
 
to Perseus:
你能告诉我怎么在程序里修改字段类型吗?
 
to Perseus:
你能告诉我怎么在程序里修改字段类型吗?

》》用SQL语句不行吗??
 
http://www.delphibbs.com/delphibbs/dispq.asp?lid=1601151
这张帖子能解决您的问题
 
接受答案了.
 
顶部