function getdays($day){ $firstday = date('Y-m-01',strtotime($day)); $lastday = date('Y-m-d',strtotime("$firstday +1 month -1 day")); return array($firstday,$lastday); } print_r(getdays('2012-06-2'));…
ufn_GetWeekFirstAndEndDay    获取指定日期所在星期的第一天和最后一天日期 ALTER FUNCTION [dbo].[ufn_GetWeekFirstAndEndDay](@tmpDate DATETIME)RETURNS  @tmpTable TABLE(            FirstDay DATETIME ,          EndDay DATETIME   )ASBEGIN    INSERT INTO @tmpTable    SELECT a.Fi…
function getdays($day){ $lastday=date('Y-m-d',strtotime("$day Sunday")); $firstday=date('Y-m-d',strtotime("$lastday -6 days")); return array($firstday,$lastday); } print_r(getdays('2012-06-2'));…
一.获取传入日期所在月的第一天 public static Date getFirstDayDateOfMonth(final Date date) { final Calendar cal = Calendar.getInstance(); cal.setTime(date); final int last = cal.getActualMinimum(Calendar.DAY_OF_MONTH); cal.set(Calendar.DAY_OF_MONTH, last); return ca…
/** * 获取指定日期所在月的开始日期与结束日期 * @param string $date * @param boolean 为true返回开始日期,否则返回结束日期 * @return array * @author zyb <zyb.allwell@gmail.com> * @access private */ private function getMonthRange( $date, $returnFirstDay = true ) { $timestamp = strtotime…
             R语言两种方式求指定日期所在月的天数 days_monthday<-function(date){ m<-format(date,format="%m") days31<-c("01","03","05","07","08","10","12") days30<-c("04",&…
<?php function getthemonth($date) { $firstday = date('Y-m-01', strtotime($date)); $lastday = date('Y-m-d', strtotime("$firstday +1 month -1 day")); return array($firstday,$lastday); } $today = date("Y-m-d"); $day=getthemonth($today)…
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace WyfClass { public class tools { /// <summary> /// 得到本周第一天(以星期天为第一天) /// </summary> /// <param name="datetime"></param> /// &l…
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace WyfClass { public class tools { /// <summary> /// 得到本周第一天(以星期天为第一天) /// </summary> /// <param name="datetime"></param> /// &l…
function getWeekRange($date){    $ret=array();    $timestamp=strtotime($date);    $w=strftime('%u',$timestamp);    $ret['sdate']=date('Y-m-d 00:00:00',$timestamp-($w-1)*86400);    $ret['edate']=date('Y-m-d 23:59:59',$timestamp+(7-$w)*86400);    retur…