首页 \ 问答 \ PHP每周三选择一次(PHP Select every other Wednesday)

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
更新时间:2022-01-26 22:01

最满意答案

您可以使用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的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 ...
  • 看起来您所有数据的优先级都为空。 这可以防止endAt和startAt正常工作。 出现问题的线索是数据中存在setPriority密钥。 优先级是在普通视图之外管理的元数据。 将您的用户创建代码更改为以下内容: create: function (authUser, username) { users[username] = { md5_hash: authUser.md5_hash, username: username, .priority: authUser.uid } ...
  • 感谢您在文档中提出这种不一致性 - 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.
  • 我认为is_leaf是不正确的。 条件应为(2*i+1 >= many_items) 。 I think is_leaf is incorrect. The condition should be (2*i+1 >= many_items).
  • 你差不多完成了,但是你应该在已经应用了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 ...
  • 我们使用多个复制的数据库服务器来进行这样的更改。 在我们的例子中, db1是master,复制到db2 。 (db1-> DB2)。 首先对db2进行更改。 如果事情锁定,复制将停止,但这没关系。 将您的流量移至db2。 任何进入db1的剩余流量都会复制过来,所以你不会丢失任何东西。 一旦db1上没有流量,将其重建为db2的从站(db2-> db1)。 这是一般的想法,你得到很少的停机时间,你不必全力以赴! 我们实际上有三台服务器,所以它有点复杂,但并不多。 祝你好运。 We use multiple, r ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。