📄 value.java
字号:
package com;
import java.util.Date;
public class Value {
public static int getValue(Date today)
{
Date now=new Date(today.getYear()+1900,today.getMonth(),today.getDate());
Date old=new Date(2008,8,15);
//Date now =new Date(2008,9,21);
int daynum=(int)((long)(now.getTime()-old.getTime())/86400000);
return daynum/7;
}
public static int getValue2(Date today)
{
Date now=new Date(today.getYear()+1900,today.getMonth(),today.getDate());
Date old=new Date(2008,8,15);
//Date now =new Date(2008,9,21);
int daynum=(int)((long)(now.getTime()-old.getTime())/86400000);
return daynum/7+1;
}
public static int getWeek(int num)
{
return num%7;
}
public static int getTime(int num)
{
return num/7;
}
public static boolean isValid(Date today)
{
if((today.getDay()==5&&today.getHours()>7)||today.getDay()==6||today.getDay()==0)
return true;
else
{
return false;
}
}
public static String[] getRiQi(Date today)
{
String RiQi[]=new String[7];
long base=today.getTime()-(((today.getDay()+6)%7)+1)*86400000;
Date datebase;
for(int i=1;i<8;i++)
{
datebase=new Date(base+i*86400000);
RiQi[i-1]=String.valueOf(datebase.getMonth()+1)+"月"+String.valueOf(datebase.getDate())+"日";
}
return RiQi;
}
public static String[] getRiQi2(Date today)
{
String RiQi[]=new String[7];
long base=today.getTime()-(((today.getDay()+6)%7)+1)*86400000+7*86400000;
Date datebase;
for(int i=1;i<8;i++)
{
datebase=new Date(base+i*86400000);
RiQi[i-1]=String.valueOf(datebase.getMonth()+1)+"月"+String.valueOf(datebase.getDate())+"日";
}
return RiQi;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -