如何使用jquery获取所选月份的所有星期四? [英] How to get all thursday of selected month using jquery?

查看:68
本文介绍了如何使用jquery获取所选月份的所有星期四?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要找到所选月份所选星期四的所有星期四。



我试过但是它提供了错误格式的数据(d / mm / yyyy)和我需要(年/月/日)。



我尝试过:



I need to find all thursday of selected thursday of selected month.

I tried but it gives data in wrong format(d/mm/yyyy) and i need in (dd/mm/yyyy).

What I have tried:

<pre> function BindAllThursdaySelectedMonth(date, index) {
          debugger;
          $("#<%=ddlThursday.ClientID%>").empty();
          $("#<%=ddlThursday.ClientID%>").append("<option value=0>select week</option>");
          var thursday = moment(date).startOf('month').day("Thursday");
          if (thursday.date() > 7) thursday.add(7, 'd');
          var month = thursday.month();
          while (month === thursday.month()) {
              $("#<%=ddlThursday.ClientID%>").append("<option>" + thursday.date() + '/' +index + '/' + thursday.year() + "</option>");
              thursday.add(7, 'd');
            
          }

      }

推荐答案

(#<%= ddlThursday .ClientID%>)。empty();
("#<%=ddlThursday.ClientID%>").empty();


(#<%= ddlThursday.ClientID%>)。append(< option value = 0> select周< /选项>中);
var thursday = moment(date).startOf('month')。day(Thursday);
if(thursday.date()> 7)thursday.add(7,'d');
var month = thursday.month();
while(month === thursday.month()){
("#<%=ddlThursday.ClientID%>").append("<option value=0>select week</option>"); var thursday = moment(date).startOf('month').day("Thursday"); if (thursday.date() > 7) thursday.add(7, 'd'); var month = thursday.month(); while (month === thursday.month()) {


(#<%= ddlThursday.ClientID%>)。append(< option> ;+ thursday.date()+'/'+ index +'/'+ thursday.year()+< / option>);
thursday.add(7,'d');

}

}
("#<%=ddlThursday.ClientID%>").append("<option>" + thursday.date() + '/' +index + '/' + thursday.year() + "</option>"); thursday.add(7, 'd'); } }


这篇关于如何使用jquery获取所选月份的所有星期四?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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