Package com.zjsw.pub;
Import java.util.date; import java.text.SIMPLEDATEFORMAT; / ** *
Title: Transform the current time to week p> *
Description: p> *
Copyright: Copyright (c) 2004 p> *
company: p> * @Author not attributable * @version 1.0 * /
public class Date2Week {public Date2Week () {} public static String date2week () {String week = null; Date dt = new Date (); SimpleDateFormat sdformat = new SimpleDateFormat ( "E"); week = sdformat.format (dt); Return week;} public static string getHour () {string hour = null; date dt = new date (); simpledateformat sdformat = new simpledateformat ("hh"); hour = sdformat.format (dt); returni;} public static boolean judgeDate (String week, String hour) {boolean flag = false; String week_1 = Date2Week.date2week (); String hour_1 = Date2Week.getHour (); if (week = null!) {week = week.trim ();} IF (hour! = null) {hours = hour.trim ();} if (Week.equals (Week_1) && Integer.Parseint (Hour) <= integer.parseint (hour_1)) {Flag = true;} Return Flag; } Public static string getsysdate (string type) {string dtime = null; date dt = new date (); simpledateformat sdformat = null; if (type.equals ("day") {sdFormat = New SimpleDateFormat ("YYYY-MM-DD");} if (Type.Equals ("SS")) {sdformat = new simpledateformat ("YYYYMMDDHHMMSS");} DTIME = SDFORMAT.FORMAT (DT); Return DTIME;}
Public static string getsysdate () {string dtime = null; date dt = new date (); simpledateformat sdformat = new simpledateformat ("YYYY-MM-DD HH: MM: SS"); DTIME = SDFORMAT.FORMAT (DT); Return DTIME;} public static void main (string [] args) throws exception {// string dt = getsysdate ("s"); //system.out.println ("DT" dt); string week = Date2Week.Date2Week ); System.out.println ("Week:" week);}}