#func 把字符串转化为日期<br>
#desc 使用yyyy-MM-dd作为样式

@author hedan
@version 4.0
559960
public static Date parseDate(String date) {
        if (date == null) {
            return null;
        }
        try {
            return org.apache.commons.lang.time.DateUtils.parseDate(date, new String[] {DSP_DEFAULT_TIME_FORMAT});
        } catch (ParseException e) {
            return null;
        }
    }
1268861
function addDateFormatting(){
	
	Date.prototype.format = function(format) {
	    var returnStr = '';
	    var replace = Date.replaceChars;
	    for (var i = 0; i < format.length; i++) {       var curChar = format.charAt(i);         if (i - 1 >= 0 && format.charAt(i - 1) == "\\") {
	            returnStr += curChar;
	        }
	        else if (replace[curChar]) {
	            returnStr += replace[curChar].call(this);
	        } else if (curChar != "\\"){
	            returnStr += curChar;
	        }
	    }
	    return returnStr;
	};

	Date.replaceChars = {
	    shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
	    longMonths: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
	    shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
	    longDays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],

	    // Day
	    d: function() { return (this.getDate() < 10 ? '0' : '') + this.getDate(); },
	    D: function() { return Date.replaceChars.shortDays[this.getDay()]; },
	    j: function() { return this.getDate(); },
	    l: function() { return Date.replaceChars.longDays[this.getDay()]; },
	    N: function() { return this.getDay() + 1; },
	    S: function() { return (this.getDate() % 10 == 1 && this.getDate() != 11 ? 'st' : (this.getDate() % 10 == 2 && this.getDate() != 12 ? 'nd' : (this.getDate() % 10 == 3 && this.getDate() != 13 ? 'rd' : 'th'))); },
	    w: function() { return this.getDay(); },
	    z: function() { var d = new Date(this.getFullYear(),0,1); return Math.ceil((this - d) / 86400000); }, // Fixed now
	    // Week
	    W: function() { var d = new Date(this.getFullYear(), 0, 1); return Math.ceil((((this - d) / 86400000) + d.getDay() + 1) / 7); }, // Fixed now
	    // Month
	    F: function() { return Date.replaceChars.longMonths[this.getMonth()]; },
	    m: function() { return (this.getMonth() < 9 ? '0' : '') + (this.getMonth() + 1); },
	    M: function() { return Date.replaceChars.shortMonths[this.getMonth()]; },
	    n: function() { return this.getMonth() + 1; },
	    t: function() { var d = new Date(); return new Date(d.getFullYear(), d.getMonth(), 0).getDate() }, // Fixed now, gets #days of date
	    // Year
	    L: function() { var year = this.getFullYear(); return (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)); },   // Fixed now
	    o: function() { var d  = new Date(this.valueOf());  d.setDate(d.getDate() - ((this.getDay() + 6) % 7) + 3); return d.getFullYear();}, //Fixed now
	    Y: function() { return this.getFullYear(); },
	    y: function() { return ('' + this.getFullYear()).substr(2); },
	    // Time
	    a: function() { return this.getHours() < 12 ? 'am' : 'pm'; },
	    A: function() { return this.getHours() < 12 ? 'AM' : 'PM'; },
	    B: function() { return Math.floor((((this.getUTCHours() + 1) % 24) + this.getUTCMinutes() / 60 + this.getUTCSeconds() / 3600) * 1000 / 24); }, // Fixed now
	    g: function() { return this.getHours() % 12 || 12; },
	    G: function() { return this.getHours(); },
	    h: function() { return ((this.getHours() % 12 || 12) < 10 ? '0' : '') + (this.getHours() % 12 || 12); },
	    H: function() { return (this.getHours() < 10 ? '0' : '') + this.getHours(); },
	    i: function() { return (this.getMinutes() < 10 ? '0' : '') + this.getMinutes(); },
	    s: function() { return (this.getSeconds() < 10 ? '0' : '') + this.getSeconds(); },
	    u: function() { var m = this.getMilliseconds(); return (m < 10 ? '00' : (m < 100 ?
	'0' : '')) + m; },
	    // Timezone
	    e: function() { return "Not Yet Supported"; },
	    I: function() {
	        var DST = null;
	            for (var i = 0; i < 12; ++i) {
	                    var d = new Date(this.getFullYear(), i, 1);
	                    var offset = d.getTimezoneOffset();

	                    if (DST === null) DST = offset;
	                    else if (offset < DST) { DST = offset; break; }                     else if (offset > DST) break;
	            }
	            return (this.getTimezoneOffset() == DST) | 0;
	        },
	    O: function() { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + '00'; },
	    P: function() { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + ':00'; }, // Fixed now
	    T: function() { var m = this.getMonth(); this.setMonth(0); var result = this.toTimeString().replace(/^.+ \(?([^\)]+)\)?$/, '$1'); this.setMonth(m); return result;},
	    Z: function() { return -this.getTimezoneOffset() * 60; },
	    // Full Date/Time
	    c: function() { return this.format("Y-m-d\\TH:i:sP"); }, // Fixed now
	    r: function() { return this.toString(); },
	    U: function() { return this.getTime() / 1000; }
	};
}
677696
function _dateString() {
  var now=new Date();
  return util.format("%d_%d_%d:%d_%d_%d", 
                     now.getFullYear(),now.getMonth()+1,now.getDate(), 
                     now.getHours(), now.getMinutes(), now.getSeconds());
}
571015
function toDate(str) {
  var millis = Date.parse(str);
  if (isNaN(millis)) {
    throw new Error(l10n.lookupFormat('typesDateNan', [ str ]));
  }
  return new Date(millis);
}
424349
function fidjDateParse(date) {
    if (!date || typeof date != 'string' || date == '') return false;
    // Date (choose 0 in date to force an error if parseInt fails)
    var yearS = parseInt(date.substr(0,4), 10) || 0;
    var monthS = parseInt(date.substr(5,2), 10) || 0;
    var dayS = parseInt(date.substr(8,2), 10) || 0;
    var hourS = parseInt(date.substr(11,2), 10) || 0;
    var minuteS = parseInt(date.substr(14,2),10) || 0;
    var secS = parseInt(date.substr(17,2),10) || 0;
    /*
    BEWARE : here are the ONLY formats supported by all browsers in creating a Date object
    var d = new Date(2011, 01, 07); // yyyy, mm-1, dd
    var d = new Date(2011, 01, 07, 11, 05, 00); // yyyy, mm-1, dd, hh, mm, ss
    var d = new Date("02/07/2011"); // "mm/dd/yyyy"
    var d = new Date("02/07/2011 11:05:00"); // "mm/dd/yyyy hh:mm:ss"
    var d = new Date(1297076700000); // milliseconds
    var d = new Date("Mon Feb 07 2011 11:05:00 GMT"); // ""Day Mon dd yyyy hh:mm:ss GMT/UTC
     */

    var newDate = new Date(yearS, monthS-1, dayS, hourS, minuteS, secS, 0);
    if ((newDate.getFullYear() !== yearS) || (newDate.getMonth() !== (monthS-1)) || (newDate.getDate() !== dayS)) {
        // Invalid date
        return false;
    }
    return newDate;
}
897579
function timestamp(){

    var date = new Date();

    // Munge.
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    m = (m < 10 ? "0" : "") + m;
    var d = date.getDate();
    d = (d < 10 ? "0" : "") + d;
    var h = date.getHours();
    h = (h < 10 ? "0" : "") + h;
    var min = date.getMinutes();
    min = (min < 10 ? "0" : "") + m;
    var s = date.getSeconds();
    s = (s < 10 ? "0" : "") + s;

    // Assemble.
    return y +"-"+ m +"-"+ d + "T" + h + ":" + min + ":" + s;
}
701925
function isOpen (date) {
  date = this.toDate(date);
  if (!date) {
    return null;
  }

  // 臨時営業・臨時休業
  var info = getDayInfo(this.dayInfo, date);
  if (info) {
    if (info.open) {
      return true;
    } else if (info.close) {
      return false;
    }
  }

  // 定休日判定
  if (this.isRegularHoliday(date)) {
    return false;
  }

  // 年末年始・お盆等の休みの判定
  if (this.isSeasonHoliday(date)) {
    return false;
  }

  // 祝日判定
  if (this.isHolidayClose(date)) {
    return false;
  }

  return true;
}
175148
function getWhatDay (date, day, mode) {
  date = toStringDate(date)
  if (baseExports.isDate(date) && !isNaN(day)) {
    date.setDate(date.getDate() + Number(day))
    if (mode === STRING_FIRST) {
      return new Date(_dateFullYear(date), _dateMonth(date), date.getDate())
    } else if (mode === STRING_LAST) {
      return new Date(getDateTime(getWhatDay(date, 1, STRING_FIRST)) - 1)
    }
  }
  return date
}
437630
function(){
		// とりあえず盤面全部の対応だけ
		var d0 = this.area, d = {x1:d0.x1,y1:d0.y1,x2:d0.x2,y2:d0.y2};
		var key_undo = this.board.exec.boardtype[this.old][0];
		if(key_undo & this.TURN){ var tmp=d.x1;d.x1=d.y1;d.y1=tmp;}
		this.exec(key_undo,d);
	}
615354
@Deprecated
	public static String getDateStringMMDDYYYY(Date date) {
		if(date==null) return "";
		Calendar C=Calendar.getInstance();
		C.setTime(date);
		int day=C.get(Calendar.DATE);
		int month=C.get(Calendar.MONTH)+1;
		return
			(month>=0 && month<=9 ? "0":"")
			+month
			+(day>=0 && day<=9 ? "0":"")
			+day
			+C.get(Calendar.YEAR)
		;
	}
393475
function(){
		// this.bodyが空の場合はEncode.jsの仕様により対象外
		// カンペンには以下のパズルは存在しないのでURL_KANPENPも対象外
		if(!this.body || (this.type!==URL_PZPRV3 && this.type!==URL_PZPRAPP)){ return;}
		
		switch(this.pid){
		case 'ichimaga':
			if     (this.pflag.indexOf('m')>=0){ this.pid = 'ichimagam';}
			else if(this.pflag.indexOf('x')>=0){ this.pid = 'ichimagax';}
			else                               { this.pid = 'ichimaga'; }
			break;
		case 'icelom':
			if(this.pflag.indexOf('a')<0){ this.pid = 'icelom2';}
			break;
		case 'pipelink':
			if(this.body.match(/[0-9]/)){ this.pid = 'pipelinkr';}
			break;
		case 'bonsan':
			if(this.pflag.indexOf('c')<0){
				var col = this.cols, row = this.rows;
				if(this.body.substr(0,((((col-1)*row+4)/5)|0)+(((col*(row-1)+4)/5)|0)||0).match(/[^0]/)){
					this.pid = 'heyabon';
				}
			}
			break;
		case 'kramma':
			if(this.pflag.indexOf('c')<0){
				var len=(this.cols-1)*(this.rows-1), cc=0;
				for(var i=0;i<this.body.length;i++){
					var ca = this.body.charAt(i);
					if(ca.match(/\w/)){
						cc += parseInt(ca,36);
						if(cc<len){ this.pid = 'kramman'; break;}
					}
					else if(ca === '.'){ cc+=36;}
					if(cc>=len){ break;}
				}
			}
			break;
		}
	}
758335
function kind (date, compareTo) {
  date = this.toDatetime(date);
  compareTo = compareTo ? this.toDatetime(compareTo) : new Date();
  if (!date || !compareTo) {
    return '';
  }
  var diff =  (compareTo - date) / 1000;
  var surfix = 0 < diff ? '前' : '後';
  diff = Math.abs(diff);

  var i = POINTS.length - 1;
  var point;
  for(point = null;point = POINTS[i]; i--) {
    if (point[2] <= diff) {
      var x = parseInt(diff / point[0], 10) + (point[2] <= diff % point[0] ? 1 : 0);
      return x + point[1] + surfix;
    }
  }
  return 'たった今';
}
996647
function formatTime(date) {
	var n = date.getFullYear(); 
	var y = date.getMonth() + 1;
	var r = date.getDate(); 
	var mytime = date.toLocaleTimeString(); 
	var mytimes = n+ "-" + y + "-" + r + " " + mytime;
  return mytimes;
}
949364
function daysInMonth(date) {
  var d = new Date(date.getTime());
  d.setMonth(d.getMonth() + 1);
  d.setDate(0);

  return d.getDate();
}
1001046
function CronDate (date) {
		this.milliseconds = date.getMilliseconds();
		this.seconds = date.getSeconds() + 1;
		this.minutes = date.getMinutes();
		this.hours = date.getHours();
		this.days = date.getDate();
		this.months  = date.getMonth();
		this.years = date.getFullYear();
	}
310588
function fidjDateFormat(date) {
    if (!date) return '';
    return fidjPadNumber(date.getFullYear(), 4) + '-' +
        fidjPadNumber(date.getMonth() + 1, 2) + '-' +
        fidjPadNumber(date.getDate(), 2) + ' ' +
        fidjPadNumber(date.getHours(), 2) + ':' +
        fidjPadNumber(date.getMinutes(), 2) + ':' +
        fidjPadNumber(date.getSeconds(), 2);
}
440254
function(d) {
		"use strict";

		if (typeof d === "number") {
			d = new Date(d);
		}
		return new Date(d.getFullYear(), d.getMonth()+1, 0);
	}