要添加到列表中的另一个DateDiff()问题 [英] Another DateDiff() problem to add to the list

查看:90
本文介绍了要添加到列表中的另一个DateDiff()问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我进行了一次小组搜索,发现了数百个问题,包括

DateDiff()。我通读了几打,但他们并没有申请我的情况。没有时间阅读所有这些我是

希望我能在这里得到答案。


软件场景。在Windows Server 2000上运行的IIS 5.0.

应用程序是一个露营地预订系统。应用程序以一个简单的HTML表单开始

,人们输入到达日期和

出发日期。这两个值传递到下一页,其中我想要返回在这两个日期之间打开的网站。

足够简单和DateDiff(d, ArrivalDate,DepartureDate)应该

返回我想要的东西。


但它没有。


如果我将于2007年5月2日进入表格(即5/2/2007)作为抵达

日期和2007年5月19日(2007年5月19日)作为出发日期我不要获得

17天作为返回值。我得到了一个约会好像我已经输入了

2月5日到5月19日,结果是103天。


我已经加倍了 - 检查服务器上的区域日期设置,它们

设置为美国(m / d / yyyy)。


这里是代码片段我正在使用:

I did a group search and found hundreds of cases of problems with
DateDiff(). I read through several dozen but they didn not apply to
my situation. Not having the time to read through all of them I''m
hoping that I''ll get an answer here.

The software scenario. IIS 5.0 running on Windows Server 2000. The
application is a campsite reservation system. The application starts
with a simple HTML form that people enter an arrival date and a
departure date. These two values are passed to the next page where I
want to return the sites that are open between those two dates.
Simple enough and DateDiff("d", ArrivalDate, DepartureDate) should
return what I want.

But it doesn''t.

If I enter May 2nd, 2007 into the form (i.e. 5/2/2007) as the arrival
date and May 19th, 2007 (5/19/2007) as the departure date I don''t get
17 days as the returned value. I get a date as if I''d entered
February 5th to May 19th and 103 days is the result returned.

I''ve double-checked the regional date settings on the server and they
are set for US (m/d/yyyy).

Here''s a snippet of the code that I''m using:

展开 | 选择 | Wrap | 行号

推荐答案

写于01 mei 2007 in microsoft.public.inetserver.asp.general:
wrote on 01 mei 2007 in microsoft.public.inetserver.asp.general:

我做了一个小组搜索并找到了hund问题案例的红色

DateDiff()。我通读了几打,但他们并没有申请我的情况。没有时间阅读所有这些我是

希望我能在这里得到答案。


软件场景。在Windows Server 2000上运行的IIS 5.0.

应用程序是一个露营地预订系统。应用程序以一个简单的HTML表单开始

,人们输入到达日期和

出发日期。这两个值传递到下一页,其中我想要返回在这两个日期之间打开的网站。

足够简单和DateDiff(d, ArrivalDate,DepartureDate)应该

返回我想要的东西。


但它没有。


如果我将于2007年5月2日进入表格(即5/2/2007)作为抵达

日期和2007年5月19日(2007年5月19日)作为出发日期我不要获得

17天作为返回值。我得到了一个约会好像我已经输入了

2月5日到5月19日,结果是103天。


我已经加倍了 - 检查服务器上的区域日期设置,它们设置为US(m / d / yyyy)。

I did a group search and found hundreds of cases of problems with
DateDiff(). I read through several dozen but they didn not apply to
my situation. Not having the time to read through all of them I''m
hoping that I''ll get an answer here.

The software scenario. IIS 5.0 running on Windows Server 2000. The
application is a campsite reservation system. The application starts
with a simple HTML form that people enter an arrival date and a
departure date. These two values are passed to the next page where I
want to return the sites that are open between those two dates.
Simple enough and DateDiff("d", ArrivalDate, DepartureDate) should
return what I want.

But it doesn''t.

If I enter May 2nd, 2007 into the form (i.e. 5/2/2007) as the arrival
date and May 19th, 2007 (5/19/2007) as the departure date I don''t get
17 days as the returned value. I get a date as if I''d entered
February 5th to May 19th and 103 days is the result returned.

I''ve double-checked the regional date settings on the server and they
are set for US (m/d/yyyy).



所以你可能错了!!!!!!!!!!!

So probably you are wrong there!!!!!!!!!!!


这里''我正在使用的代码片段:

Here''s a snippet of the code that I''m using:

展开 | 选择 | Wrap | 行号


致********** @ gmail.com 写道:

我进行了一次小组搜索,发现了数百个问题,包括

DateDiff()。我通读了几打,但他们并没有申请我的情况。没有时间阅读所有这些我是

希望我能在这里得到答案。


软件场景。在Windows Server 2000上运行的IIS 5.0.

应用程序是一个露营地预订系统。应用程序以一个简单的HTML表单开始

,人们输入到达日期和

出发日期。这两个值传递到下一页,其中我想要返回在这两个日期之间打开的网站。

足够简单和DateDiff(d, ArrivalDate,DepartureDate)应该

返回我想要的东西。


但它没有。


如果我将于2007年5月2日进入表格(即5/2/2007)作为抵达

日期和2007年5月19日(2007年5月19日)作为出发日期我不要获得

17天作为返回值。我得到了一个约会好像我已经输入了

2月5日到5月19日,结果是103天。


我已经加倍了 - 检查服务器上的区域日期设置,它们

设置为美国(m / d / yyyy)。


这里是代码片段我正在使用:

I did a group search and found hundreds of cases of problems with
DateDiff(). I read through several dozen but they didn not apply to
my situation. Not having the time to read through all of them I''m
hoping that I''ll get an answer here.

The software scenario. IIS 5.0 running on Windows Server 2000. The
application is a campsite reservation system. The application starts
with a simple HTML form that people enter an arrival date and a
departure date. These two values are passed to the next page where I
want to return the sites that are open between those two dates.
Simple enough and DateDiff("d", ArrivalDate, DepartureDate) should
return what I want.

But it doesn''t.

If I enter May 2nd, 2007 into the form (i.e. 5/2/2007) as the arrival
date and May 19th, 2007 (5/19/2007) as the departure date I don''t get
17 days as the returned value. I get a date as if I''d entered
February 5th to May 19th and 103 days is the result returned.

I''ve double-checked the regional date settings on the server and they
are set for US (m/d/yyyy).

Here''s a snippet of the code that I''m using:

展开 | 选择 | Wrap | 行号


5月1日下午12:55,Bob巴罗斯[MVP]" < reb01 ... @ NOyahoo.SPAMcom>

写道:
On May 1, 12:55 pm, "Bob Barrows [MVP]" <reb01...@NOyahoo.SPAMcom>
wrote:

>

我希望你以明确的格式输入您的日期。试试

yyyy-mm-dd

-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复

>
I hope you are entering your dates in a nonambiguous format. Try
yyyy-mm-dd

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.



这个露营地预订系统将在公众完成后向公众开放。我居住的地区是美国中西部地区,所以这里的大多数人都是

用于以mm / dd / yyyy格式输入日期。但是,日期将转换为SQL数据库中的datetime字段。但是现在

我需要能够允许人们以mm / dd / yyyy,mm-

dd-yyyy等输入日期。


我已经添加了一个中间验证页面,在传递到下一步之前检查日期值

。在这之后我注意到了一些

奇怪的事情发生在日期


- 任何月份,任何一个日期,小于12的日期月份和

日期转换

- 由于某些原因,使用MonthName()函数返回月份名称

用芬兰语而不是英语。 O.o为什么我会得到芬兰语

而不是英语?我检查了服务器上的区域设置,

我正在浏览/开发的PC,以及浏览器中的设置

(Firefox 2和IE7) )


This campsite reservations system will be open to the public once it''s
done. The area I live in is the midwest USA so most everyone here is
used to entering dates in mm/dd/yyyy format. The dates will get
converted to datetime fields in the SQL database though. But for now
I need to be able to allow people to enter dates in as mm/dd/yyyy, mm-
dd-yyyy, etc.

I''ve added a intermediary validation page that checks the date values
before passing on to the next step. After doing this I noticed some
weird things going on with the dates

- Any date, in any month, that''s less than 12 is getting the month and
date switched around
- For some reason using the MonthName() function returns month names
in Finnish instead of English. O.o Why on earth would I get Finnish
instead of English? I''ve checked the regional settings on the server,
the PC I''m browsing/developing in, and the settings in the browsers
(Firefox 2 and IE7).


这篇关于要添加到列表中的另一个DateDiff()问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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