从2日之间检查星期日 [英] check sunday from 2 between dates

查看:144
本文介绍了从2日之间检查星期日的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据库中有2个列,有30个日期

我的第一个日期从01/04/2013开始,第二个结束于2014年4月30日

和web它将以字符串格式显示

我正在使用linq在我的网页上显示日期。



现在怎么检查是否特定日期是星期日。



以下是我的linq查询

I have 2 Column in database with 30 dates
my 1st date start with 01/04/2013 and 2nd ends with 30/04/2014
and on web page it will show in a string format
i'm using linq to for showing date on my web page.

Now how can check whether the particular date is Sunday.

below is my linq query

lstAbsentReconciled = (from db_Date in Date.AsEnumerable()
                      join db_Student in Student
                      on db_Date.roll_no equals db_Student.roll_no
                      where db_Date.roll_no == lngRollNo
                      && (db_Date.student_dt >= EndDt && db_Date.student_dt <= StartDt)
                      select new Student {
                         Student_id = db_Date .Student_id,
                         student_dt = ConvertToUserDate(db_Date.student_dt),
                         roll_no = db_Date.roll_no,
                      }).Distinct().ToList();



本规范给我的结果......但是怎么会知道2个日期之间的特定日期是星期日... !!


This Code is giving me my result...but how'll come to know that particular date from between 2 dates is sunday...!!

推荐答案

那里有大量的代码'在野外'来告诉特定日期的星期几 - 这里只是搜索中的一个http://msdn.microsoft.com/en-us/library/bb762911(v=vs.110).aspx [ ^ ]



这解决了吗?他问?我猜您也可以从数据库服务器转换/获取相同的信息,具体取决于您使用的数据库服务器类型 - 例如,Oracle具有大量日期功能



'g'
there's plenty of code 'out there in the wild' to tell what day of the week a particular date is - here is but one hit from a search http://msdn.microsoft.com/en-us/library/bb762911(v=vs.110).aspx[^]

Does that solve the issue ? Im guessing you can also cast/get the same information from the database server, depending on what db server type animal you are using - Oracle for example has a large number of date functions

'g'


student_dt.DayOfWeek = DayOfWeek.Sunday





[ ^ ]


对于.NET中有关DateTime处理的所有内容,您应首先参考 DateTime 类型的MSDN页面;在那里你会发现这种类型所暴露的每种属性/方法。

日期时间结构 [ ^ ]
For everything concerning DateTime handling in .NET, you should first refer to the MSDN page of DateTime type; there you will find every property/method this type exposes.
DateTime Structure[^]


这篇关于从2日之间检查星期日的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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