输入字符串和日期格式 [英] Input string and date format

查看:83
本文介绍了输入字符串和日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个输入字段,用户输入日期。


我已经输入类似输入日期(dd / mm / yyyy)但大多数用户

不要以正确的格式输入日期。所以我希望能够获得来自用户的任何格式

,因为我必须将这些日期放在MySQL数据库中:

某种格式:(非美国)格式,日/月/年)


1/9/2004

1/09/2004

01/9 / 2004

01/09/2004

1/9/04

1/09/04

01 / 9/04

01/09/04

与其他任何分隔符相同,如'' - '',空格......

1 -9-2004

1-09-04

1 10 2004

....

最大输入字段长度是10个字符。

我必须将输入的值放在Mysql日期字段中,所以它必须很好

格式化。


它是否存在任何功能?


Bob

I''ve two input fields in wich the user enter dates.

I''ve put something like "enter date here (dd/mm/yyyy) but most of the user
don''t enter date in correct format. So I''d like to be able to get any format
coming from user as I must put those dates in a MySQL database:
some format: (non-US format, so day/month/year)

1/9/2004
1/09/2004
01/9/2004
01/09/2004
1/9/04
1/09/04
01/9/04
01/09/04
same with any other separator like ''-'', space...
1-9-2004
1-09-04
1 10 2004
....
the max input field lenght is 10 characters.
I must put the entered value in a Mysql date field, so it must be well
formatted.

Does it exists any function ?

Bob

推荐答案

Bob Bedford写道:
Bob Bedford wrote:
它是否存在任何函数?



*自动识别日期输入格式并重新格式化为

*另一种格式?


Nope。


尝试让您的用户逐位输入日期

日:(下拉列表从1到31)

月:( 1月至12月的下拉列表)

年份:(从1901年下拉列表到< current_year>)


-

邮寄到我的发件人:所有人都可以在 http://www.dodgeit 上阅读地址

== ** ## !! ------------------------------------------------ !! ## ** ==

TEXT-ONLY邮寄给整个回复:地址(我的姓名< my @ address>)

可以绕过我的垃圾邮件过滤器。如果是的话,我可以从另一个地址回复!


* that automatically recognizes the date input format and reformats to
* another format?

Nope.

Try making your users enter dates bit-by-bit
Day: (dropdown list from 1 to 31)
Month: (dropdown list from January to December)
Year: (dropdown list from 1901 to <current_year>)

--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!


2004年12月3日15:35:30 GMT,Pedro Graca< he **** @ dodgeit.com> ;写道:
On 3 Dec 2004 15:35:30 GMT, Pedro Graca <he****@dodgeit.com> wrote:
Bob Bedford写道:
Bob Bedford wrote:
它是否存在任何函数?


*自动识别日期输入格式并重新格式化
*另一种格式?

没有。

尝试让你的用户逐点输入日期

日:(下拉菜单)列表从1到31)
月份:(从1月到12月的下拉列表)
年份:(从1901年下拉列表到< current_year>)


* that automatically recognizes the date input format and reformats to
* another format?

Nope.

Try making your users enter dates bit-by-bit
Day: (dropdown list from 1 to 31)
Month: (dropdown list from January to December)
Year: (dropdown list from 1901 to <current_year>)




除非你实施javascript或类似的东西,否则

允许2004年2月31日这样的日期

-

gburnore @databasix dot com

-------------------------------------- -------------------------------------

你看起来如何取决于你去哪里。

-------------------------------------- -------------------------------------

Gary L. Burnore | Y?3oY3T3oY33Y?oY3T3oY3Y3T3oY3YY?3
DataBasix | Y?3oY3T3oY33Y?oY3T3oY3Y3T3oY3YY?3

黑色直升机维修Svcs部门|官方购买证明

====================================== ============ =========================

想要一个吗?得到一个! http://signup.databasix.com

=== =============================================== === ======================



Which, unless you implement javascript or something similar, would
allow for such dates as 31 Feb, 2004
--
gburnore@databasix dot com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | Y?3oY3T3oY33Y?oY3T3oY3Y3T3oY3YY?3
| Y?3oY3T3oY33Y?oY3T3oY3Y3T3oY3YY?3
DataBasix | Y?3oY3T3oY33Y?oY3T3oY3Y3T3oY3YY?3
| Y?3 3 4 1 4 2 Y3T3 6 9 0 6 9 Y?3
Black Helicopter Repair Svcs Division | Official Proof of Purchase
================================================== =========================
Want one? GET one! http://signup.databasix.com
================================================== =========================


" Gary L. Burnore" < GB ****** @ databasix.com> écritdansle message de news:

co ********** @ blackhelicopter.databasix.com ...
"Gary L. Burnore" <gb******@databasix.com> a écrit dans le message de news:
co**********@blackhelicopter.databasix.com...
2004年12月3日15: 35:30 GMT,Pedro Graca< he **** @ dodgeit.com>写道:
On 3 Dec 2004 15:35:30 GMT, Pedro Graca <he****@dodgeit.com> wrote:
Bob Bedford写道:
Bob Bedford wrote:
它是否存在任何函数?


*自动识别日期输入格式并重新格式化
*另一种格式?

没有。

尝试让你的用户逐点输入日期

日:(下拉菜单)列表从1到31)
月份:(从1月到12月的下拉列表)
年份:(从1901年下拉列表到< current_year>)


* that automatically recognizes the date input format and reformats to
* another format?

Nope.

Try making your users enter dates bit-by-bit
Day: (dropdown list from 1 to 31)
Month: (dropdown list from January to December)
Year: (dropdown list from 1901 to <current_year>)



,除非你实现javascript或类似的东西,否则将允许2004年2月31日这样的日期



Which, unless you implement javascript or something similar, would
allow for such dates as 31 Feb, 2004




我会说我想绝对避免这样的输入类型。我(和大多数b $ b用户)讨厌这样的条目类型,也因为它们附近的所有其他字段都是

键盘输入,我想避免使用键盘 - 鼠标 - 键盘 - 鼠标领域

(即使人们可能在下拉菜单上使用键盘,大多数人都不知道你可以)。它必须是键盘输入。


Bob



I would have said I want absolutely avoid such entry type. I (and most
users) hate such entry type, also because all other fields close to them are
keyboard entries, I want to avoid the keyboard-mouse-keyboard-mouse fields
(even if people may use keyboard on dropdown, most don''t know you can). it
must be keyboard entry.

Bob


这篇关于输入字符串和日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆