java计算日期问题用户从键盘输入一个时间,如:2013-11-06 18:30:38,输入一个整数n,例如n=280,
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/07/17 16:20:56
java计算日期问题
用户从键盘输入一个时间,如:2013-11-06 18:30:38,输入一个整数n,例如n=280,程序输出距离该时间n天后的时间,并用格式xxxx年xx月xx日xx 小时:xx分:xx秒输出新时间.
用户从键盘输入一个时间,如:2013-11-06 18:30:38,输入一个整数n,例如n=280,程序输出距离该时间n天后的时间,并用格式xxxx年xx月xx日xx 小时:xx分:xx秒输出新时间.
BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); System.out.print("请输入时间(注意格式必须为yyyy-MM-dd HH:mm:ss):"); String time = buf.readLine(); System.out.print("请输入时间间隔:"); int next = Integer.parseInt(buf.readLine()); DateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = f.parse(time); System.out.println(date); Calendar cal = new GregorianCalendar(); cal.setTime(date); cal.add(Calendar.DAY_OF_YEAR,next ); date = cal.getTime(); f= new SimpleDateFormat("yyyy年MM月dd日 HH小时mm分ss秒"); System.out.println("增加了"+next+"天之后的日期是:"+f.format(date));
再问: BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));�������� ����˰�Ҳû��
再答: import java.io.BufferedReader;import java.io.InputStreamReader; ��������������쳣ճ�����ɣ�
再问: Multiple markers at this line - BufferedReader cannot be resolved to a type - InputStreamReader cannot be resolved to a type - BufferedReader cannot be resolved to a type Ҳ���У��쳣�����
再答: ��Ļ����м���jre����û�С�ϵͳ����������û�С����������jre�汾���ԡ� ����������� Scanner sc = new Scanner(System.in);����������һ��
再问: BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));�������� ����˰�Ҳû��
再答: import java.io.BufferedReader;import java.io.InputStreamReader; ��������������쳣ճ�����ɣ�
再问: Multiple markers at this line - BufferedReader cannot be resolved to a type - InputStreamReader cannot be resolved to a type - BufferedReader cannot be resolved to a type Ҳ���У��쳣�����
再答: ��Ļ����м���jre����û�С�ϵͳ����������û�С����������jre�汾���ԡ� ����������� Scanner sc = new Scanner(System.in);����������һ��
java计算日期问题用户从键盘输入一个时间,如:2013-11-06 18:30:38,输入一个整数n,例如n=280,
java编程!用户从键盘输入一个整数n,程序求出n的累加和并输出.(如:1+2+3+4+……+n)
C语言列问题 从键盘输入一个整数n,请输入1,2,……,n的所有排列
从键盘输入一个正整数n,计算该数的各位数字之和并输出.例如,输入5246,则计算5+2+4+6=17并输出.
从键盘输入一个正整数n,再接着输入n个整数,计算并输出这n个数中的最大值下最小值的差.
从键盘输入整数n(n
从键盘上输入任意一个整数n,计算1到n的和.输入 从键盘输入任意整数n.输出1到n的和.用c语言
c++从键盘输入整数n,计算1+2+3+.+n
【问题描述】从键盘输入一个正整数n,计算n!的值.要求定义和调用函数fact(n),函数类型为double型.【输入形式
请用Visual FoxPro编写一个程序计算1+2+3+4+…+n的值,n为从屏幕接收用户输入的任意整数.
一、 编写程序,从键盘输入一个整数N(N
c语言求解.从键盘输入一个正整数N,再输入N个整数,按从小到大的顺序输出.