DateTime表示时间上的一刻,通常以日期和当天的时间表示.借用这个结构,我们可以实现较丰富的功能,本文给出得到每周每天的方法,及得到本月第一天,本月最后一天,本季第一天,本季最后一天,本年第一天及本年最后一天的方法,这在一些与财务有关或库存管理软件中非常有用. DateTime dt = DateTime.Now; //得到当前时间 DateTime startYear = , ); //本年年初 DateTime endYear = , ); //本年年末 DateTime startQu…
oracle 按每天,每周,每月,每季度,每年查询统计数据 //按天统计 select count(dataid) as 每天操作数量, sum() from tablename group by trunc(createtime, 'DD')) //按自然周统计 select to_char(date,'iw'),sum() from tablename group by to_char(date,'iw') //按自然月统计 select to_char(date,'mm'),sum() f…
在  source/admincp/admincp_credits.php 文件中, ctrl+f 搜索  $lang['setting_credits_policy_cycletype_1'] 处,  在后面添加一行: array(5, $lang['setting_credits_policy_cycletype_5'], array('cycletimetd' => 'none', 'rewardnumtd' => '')), 我把"每周" 的表单值设置为5 , 在语…
摘自:http://blog.csdn.net/cselmu9/article/details/8625530#t6 在开发中经常会使用到一些日期方面的操作,下面例子展示几个常用的操作. 1.取得指定日期是星期几 取得指定日期是星期几可以采用下面两种方式取得日期是星期几: a.使用Calendar类 b.使用SimpleDateFormat类 //根据日期取得星期几 public static String getWeek(Date date){ SimpleDateFormat sdf = n…
1.对整数进行格式化:%[index$][标识][最小宽度]转换方式        我们可以看到,格式化字符串由4部分组成,其中%[index$]的含义我们上面已经讲过,[最小宽度]的含义也很好理解,就是最终该整数转化的字符串最少包含多少位数字.我们来看看剩下2个部分的含义吧: 标识: '-'    在最小宽度内左对齐,不可以与“用0填充”同时使用'#'    只适用于8进制和16进制,8进制时在结果前面增加一个0,16进制时在结果前面增加0x'+'    结果总是包括一个符号(一般情况下只适用…
1.tool->new snippet(工具->新代码段) 创建一个新的snippet,并保存为author.sublime-snippet(最好在该目录(User)下再创建一个MySnippet目录): 其内容: <snippet> <content><![CDATA[ /** * ============================ * @Author: XX * @Version: 1.0 * @DateTime: ${1:ctrl+alt+shift+…
1. 要求 对List列表中的数据进行排序(正序.倒序),列表中的数据包括:整型(Integer).字符串(String).日期(Date)等.对于字符串,要求允许对它按照整型进行排序. 2. 实现思路 1. 对于整型.字符串.日期等数据,可以直接调用Collections.sort方法实现排序(正序.倒序). 2. 对于字符串按照整型排序,可以写一个类实现Comparable接口,在compare方法中将字符转换为整型进行比较:然后再调用Collections.sort的方法,传进一个Comp…
       在我们平时的工作开发中.我们一般会遇到这种一个问题:某个实体的某个字段是DateTime类型的,但是我们在界面上仅仅想让它显示日期不显示时间! 一个订单实体: //订单类 public class order { //订单ID public int id{get;set;} //物品ID public int resId{get;set;} //物品名称 public string resName { get; set; } //物品价格 public decimal price…
/** * 获取本周.本季度.本月.上月的开端日期.停止日期 */ var now = new Date(); //当前日期 var nowDayOfWeek = now.getDay(); //今天本周的第几天 var nowDay = now.getDate(); //当前日 var nowMonth = now.getMonth(); //当前月 var nowYear = now.getYear(); //当前年 nowYear += (nowYear < 2000) ? 1900 :…
select to_date(to_char(sysdate,'yyyy-mm-dd hh'),'yyyy-mm-dd hh:mi:ss') from dual;select to_date(to_char(SYSDATE - 1 / 24,'yyyy-mm-dd hh'),'yyyy-mm-dd hh:mi:ss') from dual;…