PHP每周三选择一次(PHP Select every other Wednesday)
我需要帮助从2012年5月2日开始每隔一个星期三选择一次。 下面的代码从当前的一周开始选择每隔一个星期三。 但我需要设定开始周。 我熟悉PHP,但不熟悉php日期。 所以请尽可能具体。 我找到了这个:
$number_of_dates = 10; for ($i = 0; $i < $number_of_dates; $i++) { echo date('m-d-Y', strtotime('Wednesday +' . ($i * 2) . ' weeks')). "<br>".PHP_EOL; }
I need help Select every other Wednesday starting on 5/2/12. This code below selects every other Wednesday starting on the week it currently is. But i need to set the beginning week. I am familiar with PHP, but not familiar with php dates. So please be as specific as possible. I found this:
$number_of_dates = 10; for ($i = 0; $i < $number_of_dates; $i++) { echo date('m-d-Y', strtotime('Wednesday +' . ($i * 2) . ' weeks')). "<br>".PHP_EOL; }
原文:https://stackoverflow.com/questions/10420401
最满意答案
您可以使用startAt / endAt的第二个参数执行此操作。
请注意,在排序消息时优先级始终优先,因此对于要按索引排序的所有项,您需要优先级相同(即为null)。
然后你就这样做:
ref.startAt(null, indexToStartAt).endAt(null, indexToEndAt);
You can do this using the second argument to startAt / endAt.
Note that priority always takes precedence when ordering messages, so you'll need the priority to be the same (ie null) for all items you want to sort by index.
You then just do this:
ref.startAt(null, indexToStartAt).endAt(null, indexToEndAt);
相关问答
更多-
您可以使用startAt / endAt的第二个参数执行此操作。 请注意,在排序消息时优先级始终优先,因此对于要按索引排序的所有项,您需要优先级相同(即为null)。 然后你就这样做: ref.startAt(null, indexToStartAt).endAt(null, indexToEndAt); You can do this using the second argument to startAt / endAt. Note that priority always takes precede ...
-
Objectify SimpleQuery.endAt() - 它究竟从哪里开始?(Objectify SimpleQuery.endAt() - where exactly does it start from?)[2022-02-08]
Objectify的endAt()只是将光标传递给低级API的FetchOptions.endCursor() ; limit()只是将值传递给FetchOptions.limit() 。 互动由Google定义,似乎没有记录。 我能找到的最相关的位是: https://cloud.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/FetchOptions#endCursor(com.google.appeng ... -
startAt和endAt使用angularfire不能正常工作:0.8.0(startAt and endAt not working as expected using angularfire : 0.8.0)[2022-03-27]
看起来您所有数据的优先级都为空。 这可以防止endAt和startAt正常工作。 出现问题的线索是数据中存在setPriority密钥。 优先级是在普通视图之外管理的元数据。 将您的用户创建代码更改为以下内容: create: function (authUser, username) { users[username] = { md5_hash: authUser.md5_hash, username: username, .priority: authUser.uid } ... -
startAt / endAt和date之间的Foursquare差异(Foursquare difference between startAt/endAt and date)[2022-11-18]
感谢您在文档中提出这种不一致性 - date字段适用于全天活动。 我们将此添加到文档中。 Thanks for bringing up this inconsistency in the docs—the date field is there for an all-day event. We'll add this to the documentation. -
优先级队列堆实现(Priority Queue Heap Implementation)[2023-05-26]
我认为is_leaf是不正确的。 条件应为(2*i+1 >= many_items) 。 I think is_leaf is incorrect. The condition should be (2*i+1 >= many_items). -
Firebase Android - startAt()和endAt()无法正常工作?(Firebase Android - startAt() and endAt() not working correctly?)[2022-05-02]
你差不多完成了,但是你应该在已经应用了orderBy() , startAt() , endAt()的数据库引用之后添加addListenerForSingleValueEvent 。 usersRef.orderByChild("username") .startAt(queryText) .endAt(queryText+"\uf8ff") .addListe ... -
这些是在更改密钥时需要执行的二进制堆上的操作。 优先级队列中的每个“节点”都保存在二进制堆中。 当您添加项目时,该项目需要位于正确的位置,因此“二进制堆的规则”不会被破坏。 更改密钥时也会发生同样的情况,您需要更改项目在优先级堆中的位置,以便不破坏规则(该项目的子项不大于该项目,并且该项目的父项不小)。 这个优先级队列是用二进制堆实现的,这意味着它基于二叉树,这就是为什么你可以在这些方法中看到除以2的原因,因为它需要逐层上下项目,这是由该部门实现的(第一级有一个节点,第二级有两个节点,第三级有四个节点等,每 ...
-
当您调用orderByChild()对startAt() , endAt()或orderByChild()任何后续调用都startAt()您传入的值为子级。 你正在传递一个索引。 除非domain的值是顺序索引(极不可能),否则这将不起作用。 你应该做的是记住你得到的最后一个孩子的domain值,然后将其传递给startAt()以获取下一个“页面”。 var productsRef = ref.child('products'); var lastKnownDomainValue = null; var p ...
-
看起来你正试图同步运行这些命令。 在您申请奖励时,可能还没有任何数据(您的推送操作可能尚未完成)。 接下来,您应该使用setWithPriority,它允许您同时推送数据和优先级。 最后但同样重要的是,您没有提到错误。 我假设你像任何勤奋的开发者那样检查过那些。 除了JS控制台之外,您还可以记录回调函数的结果(对于您调用的每个方法都有一个,如果出现问题,可能会返回错误)。 总而言之,它应该看起来更像这样: var ref = new Firebase('https://
.firebasei ... -
降低MySQL命令/作业的优先级(添加索引/其他命令)?(Reducing priority of MySQL commands/jobs (add an index/other commands)?)[2021-09-01]
我们使用多个复制的数据库服务器来进行这样的更改。 在我们的例子中, db1是master,复制到db2 。 (db1-> DB2)。 首先对db2进行更改。 如果事情锁定,复制将停止,但这没关系。 将您的流量移至db2。 任何进入db1的剩余流量都会复制过来,所以你不会丢失任何东西。 一旦db1上没有流量,将其重建为db2的从站(db2-> db1)。 这是一般的想法,你得到很少的停机时间,你不必全力以赴! 我们实际上有三台服务器,所以它有点复杂,但并不多。 祝你好运。 We use multiple, r ...