[好物] Javascript Date Function

JavaScript Date Format

http://blog.stevenlevithan.com/archives/date-time-format

Datejs is an open-source JavaScript Date Library.

http://www.datejs.com/

實作:

function set_next_date(date_name)
{
var exe_cmd = “Date.today().next()." + date_name + “()";
$(“#date_rang input[id=start_date]“).val((dateFormat(eval(exe_cmd), “yyyy-mm-dd")));
$(“#date_rang input[id=end_date]“).val((dateFormat(eval(exe_cmd), “yyyy-mm-dd")));
$(“#date_rang form[id=form1]“).submit();
}

function set_next_date(date_name)
{
var exe_cmd = “Date.today().next()." + date_name + “()";
$(“#date_rang input[id=start_date]“).val((dateFormat(eval(exe_cmd), “yyyy-mm-dd")));
$(“#date_rang input[id=end_date]“).val((dateFormat(eval(exe_cmd), “yyyy-mm-dd")));
$(“#date_rang form[id=form1]“).submit();
}
</script>

<div id="date_rang">
Next Dates:
<input type="button" value="Monday" onClick="set_next_date('monday');" />
<input type="button" value="Tuesday" onClick="set_next_date('tuesday');" />
<input type="button" value="Wednesday" onClick="set_next_date('wednesday');" />
<input type="button" value="Thursday" onClick="set_next_date('thursday');" />
<input type="button" value="Friday" onClick="set_next_date('friday');" />

<form id="form1" name="form1" method="post" action="./?date">
	Request Date<br />Date Range: <input type="text" value="2009-02-16" id="start_date" name="start_date" /> ~ 
<input type="text" value="2009-02-16" id="end_date" name="end_date" />
	<input type="submit" id="Search" name="Search" value="Search"/>
</form>
</div>

Comments are closed.

十一月 2019
« 五月    
 123
45678910
11121314151617
18192021222324
252627282930  

Google ADs