如何获得两个日期之间的价值? [英] How to get the value between two Dates?

查看:64
本文介绍了如何获得两个日期之间的价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<pre lang="xml">This is sample data table.


PURC_ID---------PRICE---------UNIT------------------QTY--------Date_Purchased

IP-16701--------233981--------Samsung Gal S--------1--------7/1/2014 10:03:59 PM
IP-16701--------233981--------Samsung Gal S--------1--------7/5/2014 10:03:59 PM
IP-16701--------233981--------Samsung Gal S--------1--------7/22/2014 7:03:59 PM
IP-16701--------233981--------Samsung Gal S--------1--------8/3/2014 10:03:59 PM
IP-16701--------233981--------Samsung Gal S--------1--------8/10/2014 8:03:59 PM
IP-16701--------233981--------Samsung Gal S--------1--------8/15/2014 9:03:59 PM
IP-95975--------180866--------Sony Xperia Z--------1--------8/25/2014 1:31:53 PM
IP-95975--------180866--------Sony Xperia Z--------1--------8/26/2014 1:31:53 PM


This is what I want to do.

If I choose weekly it will get all the data from the current date until the starting date which is Monday. The format will be Monday - Sunday for weekly.

IP-95975--------180866--------Sony Xperia Z--------1--------8/25/2014 1:31:53 PM
IP-95975--------180866--------Sony Xperia Z--------1--------8/26/2014 1:31:53 PM

and If I choose monthly it will display all the data from Day 1 - 31.

IP-16701--------233981--------Samsung Gal S--------1--------8/3/2014 10:03:59 PM
IP-16701--------233981--------Samsung Gal S--------1--------8/10/2014 8:03:59 PM
IP-16701--------233981--------Samsung Gal S--------1--------8/15/2014 9:03:59 PM
IP-95975--------180866--------Sony Xperia Z--------1--------8/25/2014 1:31:53 PM
IP-95975--------180866--------Sony Xperia Z--------1--------8/26/2014 1:31:53 PM







谢谢求助你。




Thanks for your help.

推荐答案

尝试以下SQL语句



Try the following SQL statement

"SELECT ProductID,Price,ProductName,Qty FROM Transaction Where Date_Purchased between '" + ddldatestart + "' AND '" + ddldateend  + "'";


这篇关于如何获得两个日期之间的价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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