java怎么實(shí)現(xiàn)可視化日歷小程序

這篇文章主要介紹“java怎么實(shí)現(xiàn)可視化日歷小程序”,在日常操作中,相信很多人在java怎么實(shí)現(xiàn)可視化日歷小程序問題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”java怎么實(shí)現(xiàn)可視化日歷小程序”的疑惑有所幫助!接下來,請(qǐng)跟著小編一起來學(xué)習(xí)吧!

創(chuàng)新互聯(lián)建站-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比大方網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫(kù),直接使用。一站式大方網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋大方地區(qū)。費(fèi)用合理售后完善,10多年實(shí)體公司更值得信賴。

廢話不多說,直接上代碼

import java.text.DateFormat;import java.text.ParseException;import java.text.SimpleDateFormat;import java.util.Calendar;import java.util.Date;import java.util.GregorianCalendar; /** * 可視化日歷程序 * * @author HQ * @e-mail ahmashq95@gmail.com * @date 2018/10/11. */public class TestCalendar2 { public static void main(String[] args) throws ParseException {  String string = "2018-10-11";    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");  Date date = dateFormat.parse(string);  Calendar calendar = new GregorianCalendar();  calendar.setTime(date);  int days = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);  int day = calendar.get(Calendar.DAY_OF_MONTH);   System.out.println("日\(chéng)t一\t二\t三\t四\t五\t六");  calendar.set(Calendar.DAY_OF_MONTH, 1);   for (int i = 0; i < calendar.get(Calendar.DAY_OF_WEEK) - 1; i++) {   System.out.print("\t");  }   for (int i = 1; i <= days; i++) {   //判斷是否為輸入的時(shí)間是否為今天   if(day==calendar.get(Calendar.DAY_OF_MONTH)){    //如果是今天的話用紅色標(biāo)記    System.out.print("\u001b[31m"+calendar.get(Calendar.DAY_OF_MONTH) + "\t"+"\u001b[0m");   }else{    System.out.print(calendar.get(Calendar.DAY_OF_MONTH) + "\t");   }    if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {    System.out.println(); //換行   }   calendar.add(Calendar.DAY_OF_MONTH, 1);  } }}

到此,關(guān)于“java怎么實(shí)現(xiàn)可視化日歷小程序”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)砀鄬?shí)用的文章!

網(wǎng)站標(biāo)題:java怎么實(shí)現(xiàn)可視化日歷小程序
網(wǎng)頁(yè)URL:http://bm7419.com/article32/gihspc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站電子商務(wù)、網(wǎng)站內(nèi)鏈、品牌網(wǎng)站設(shè)計(jì)、App設(shè)計(jì)網(wǎng)站排名

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)