dtp->
SetFormatString
(
"YYYY-MM-DD"
,
DATETIMEPARSERMODE::DATE
);
dtp->
SetFormatString
(
"HH:MM:SS"
,
DATETIMEPARSERMODE::TIME
);
String
sDateFormat = dtp->
GetFormatString
(
DATETIMEPARSERMODE::DATE
);
String
sTimeFormat = dtp->
GetFormatString
(
DATETIMEPARSERMODE::TIME
);
GePrint
(sDateFormat +
" "
+ sTimeFormat);
DateTime
dt;
dtp->
ParseString
(
"110325"
, dt,
DATETIMEPARSERMODE::DATE
);
dtp->
ParseString
(
"54321"
, dt,
DATETIMEPARSERMODE::TIME
);
String
sDate = dtp->
MakeString
(dt,
DATETIMEPARSERMODE::DATE
);
String
sTime = dtp->
MakeString
(dt,
DATETIMEPARSERMODE::TIME
);
GePrint
(sDate +
" "
+ sTime);
构造函数 & 析构函数文档编制
◆
DateTimeParser()
◆
~DateTimeParser()
成员函数文档编制
◆
Alloc()
Allocates a date time parser. Destroy the allocated date time parser with
Free()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
-
返回
-
The allocated date time parser, or
nullptr
if the allocation failed.
◆
Free()
Destructs date time parsers allocated with
Alloc()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
-
参数
-
[in,out]
|
dtp
|
The date time parser to destruct. If the pointer is
nullptr
nothing happens. The pointer is assigned
nullptr
afterwards.
|
◆
ParseString()
Parses a date time string.
-
参数
-
[in]
|
str
|
The string to parse.
|
[in]
|
result
|
Assigned the parsed result.
|
[in]
|
mode
|
The date time mode:
DATETIMEPARSERMODE
|
-
返回
-
true
if successful, otherwise
false
.
◆
MakeString()
Creates a date time string, e.g.
"12:24:05"
or
"2011-08-23"
.
-
参数
-
[in]
|
dt
|
The date time to create the string from.
|
[in]
|
mode
|
The date time mode:
DATETIMEPARSERMODE
|
-
返回
-
The date time string.
◆
SetFormatString()
Sets the formating of the time string.
-
参数
-
[in]
|
sFormat
|
The formating string, e.g.
"HH:MM:SS"
for time and
"YYYY-MM-DD"
for the date.
|
[in]
|
mode
|
The date time mode:
DATETIMEPARSERMODE
|
◆
GetFormatString()
Retrieves the current date time formating string.
-
参数
-
-
返回
-
The formating string, e.g.
"HH:MM:SS"
for time and
"YYYY-MM-DD"
for the date.
String GetFormatString(DATETIMEPARSERMODE mode)
void SetFormatString(const String &sFormat, DATETIMEPARSERMODE mode)
void GePrint(const maxon::String &str)
String MakeString(const DateTime &dt, DATETIMEPARSERMODE mode)
Represents a date and time.
定义:
customgui_datetime.h:38
Bool ParseString(const String &str, DateTime &result, DATETIMEPARSERMODE mode)