比如输入年月日,应如何用C语言限定输入格式?

vicent3 2010-04-30 03:43:16
使得输入只能数字日期格式,可以的话VB,C#,C++源码也给我。谢谢!
...全文
410 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
azure110 2010-05-04
  • 打赏
  • 举报
回复
顶..
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 zhao4zhong1 的回复:]
COleDateTime::ParseDateTime
BOOL ParseDateTime( LPCTSTR lpszDate, DWORD dwFlags = 0, LCID lcid = LANG_USER_DEFAULT );
throw( CMemoryException );
throw( COleException );

Return Value

Nonzero i……
[/Quote]

仔细看吧,反正我没看的
赵4老师 2010-04-30
  • 打赏
  • 举报
回复
COleDateTime::ParseDateTime
BOOL ParseDateTime( LPCTSTR lpszDate, DWORD dwFlags = 0, LCID lcid = LANG_USER_DEFAULT );
throw( CMemoryException );
throw( COleException );

Return Value

Nonzero if the string was successfully converted to a date/time value, otherwise 0.

Parameters

lpszDate

A pointer to the null-terminated string which is to be parsed. For details, see Remarks.

dwFlags

Indicates flags for locale settings and parsing. One or more of the following flags:

LOCALE_NOUSEROVERRIDE Use the system default locale settings, rather than custom user settings.


VAR_TIMEVALUEONLY Ignore the date portion during parsing.


VAR_DATEVALUEONLY Ignore the time portion during parsing.
lcid

Indicates locale ID to use for the conversion.

Remarks

Call this member function to parse a string to read a date/time value. If the string was successfully converted to a date/time value, the value of this COleDateTime object is set to that value and its status to valid.

Note Year values must lie between 100 and 9999, inclusively.

The lpszDate parameter can take a variety of formats. For example, the following strings contain acceptable date/time formats:

"25 January 1996"
"8:30:00"
"20:30:00"
"January 25, 1996 8:30:00"
"8:30:00 Jan. 25, 1996"
"1/25/1996 8:30:00" // always specify the full year,
// even in a 'short date' format

33,311

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 新手乐园
社区管理员
  • 新手乐园社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧