久久久久久久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...

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

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模板網!

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

相關文檔推薦

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:獲取當前星期幾的值)
主站蜘蛛池模板: 久久久久国产精品 | 日韩欧美一区二区三区四区 | 亚洲一区免费 | 精品日韩一区二区 | 国产精品自拍av | 99精品视频在线观看 | 亚洲视频一区在线 | 91在线视频免费观看 | aaa一区 | 视频在线一区 | 四虎av电影 | 一区二区蜜桃 | 免费三级网 | 在线欧美亚洲 | 日韩久久中文字幕 | 成人3d动漫一区二区三区91 | 亚洲电影在线播放 | 国产精品亚洲二区 | 日韩中文字幕在线观看 | 精精国产xxxx视频在线播放 | 久久久久久久国产精品 | 亚洲成人第一页 | 欧美性乱| 国产精品免费看 | 日韩性在线 | 免费大黄视频 | 精品在线99 | 国产一级片网站 | 国产成人精品一区二区三区网站观看 | 久久久成人网 | 亚洲精品久久久 | 国产欧美日韩在线观看 | 一区二区三区久久久 | 亚洲激情视频在线 | 亚洲人成人一区二区在线观看 | 老司机久久 | 日本在线一区二区三区 | 欧美二区三区 | 久久久久久久久久久91 | 亚洲精品一区二区三区免 | 欧美一级黄 |