久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何從指定日期獲取上周五的日期?

How to get date of last Friday from specified date?(如何從指定日期獲取上周五的日期?)
本文介紹了如何從指定日期獲取上周五的日期?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我怎樣才能找到上一個(前一個)星期五"的日期或從指定日期開始的任何其他日期?

How can I find out the date of last (previous) "Friday" or any other day from a specified date?

public getDateOnDay(Date date, String dayName) {
    // ?
}

推薦答案

我不會給出答案(先自己試試吧!),但是,也許這些提示可以幫助你.

I won't give an answer (try it yourself first!), but, maybe these tips can help you out.

  1. 您首先需要確定您所在的星期幾.您可能想看看 Java 的 日歷類來了解如何做到這一點.
  2. 一旦您獲得了您所在的日期,請考慮模數運算符以及如何使用它向后移動以從您當前所在的那一天開始獲取您正在尋找的前一天.(請記住,一周有 7 天,一周中的每一天在這 7 天中占據一個空檔".)
  3. 一旦確定了兩者之間的天數,您就會想減去.當然,Java框架中也有可以為你加減天數的類……
  1. You first need to figure out the current day of the week you are on. You may want to take a look at Java's Calendar class to get an idea of how to do that.
  2. Once you get the date you are on, think about the modulus operator and how you can use that to move backwards to pick up the previous day that you are looking for from the day you are currently at. (Remember, a week is 7 days and each day of the week takes up a "slot" in those 7 days.)
  3. Once you have the number of days in between, you'll want to subtract. Of course, there are classes that can add and subtract days for you in the Java framework...

我希望這會有所幫助.再次,我鼓勵你總是先自己嘗試這個問題.從長遠來看,您可以通過這種方式學到更多東西,并成為更好的開發人員.

I hope that helps. Again, I encourage you to always try the problem for yourself, first. You learn far much more that way and be a better developer in the long run for it.

這篇關于如何從指定日期獲取上周五的日期?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Parsing an ISO 8601 string local date-time as if in UTC(解析 ISO 8601 字符串本地日期時間,就像在 UTC 中一樣)
How to convert Gregorian string to Gregorian Calendar?(如何將公歷字符串轉換為公歷?)
Java: What/where are the maximum and minimum values of a GregorianCalendar?(Java:GregorianCalendar 的最大值和最小值是什么/在哪里?)
Calendar to Date conversion for dates before 15 Oct 1582. Gregorian to Julian calendar switch(1582 年 10 月 15 日之前日期的日歷到日期轉換.公歷到儒略歷切換)
java Calendar setFirstDayOfWeek not working(java日歷setFirstDayOfWeek不起作用)
Java: getting current Day of the Week value(Java:獲取當前星期幾的值)
主站蜘蛛池模板: 国产精品一区二区久久 | 另类二区| ww 255hh 在线观看 | 国产视频一视频二 | jvid精品资源在线观看 | www.成人久久 | 国产精品国产a级 | 国产免费国产 | 欧美日韩国产一区二区三区 | 午夜在线免费观看 | 天天天天操 | 久色 | gav成人免费播放视频 | 亚洲一区久久 | 国产你懂的在线观看 | 国产91网址 | 人人射人人插 | 91资源在线 | 一区二区三区在线免费观看 | 亚洲综合二区 | 国产成人综合一区二区三区 | 久久久久精 | 大久 | 欧美mv日韩mv国产网站91进入 | 日韩区 | 一区二区三区福利视频 | 精品欧美一区二区精品久久久 | 国产成人99久久亚洲综合精品 | 91精品久久久久久久 | 蜜臀网| 在线免费视频一区 | 国内精品视频一区二区三区 | 日韩黄 | 欧美一级大片 | 欧美精品在线播放 | 日日草夜夜草 | 亚洲国产成人av好男人在线观看 | 国产亚洲网站 | 婷婷不卡| 午夜免费在线电影 | 日韩在线免费视频 |