Last active
August 29, 2015 14:13
-
-
Save jukbot/1532bbb9b26150c2404c to your computer and use it in GitHub Desktop.
Java Fulldate format for GUI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Calendar; | |
import java.util.GregorianCalendar; | |
class JukFullDate { | |
public static void main (String args[]) { | |
int timeRun = 0; | |
//initComponents(); | |
new Thread() { | |
public void run() { | |
while(timeRun == 0) //loop forever | |
try { | |
Calendar cal = new GregorianCalendar(); | |
int hour = cal.get(Calendar.HOUR); | |
int min = cal.get(Calendar.MINUTE); | |
int sec = cal.get(Calendar.SECOND); | |
int date = cal.get(Calendar.DATE); | |
int dayofweek = cal.get(Calendar.DAY_OF_WEEK); | |
int month = cal.get(Calendar.MONTH); | |
int year = cal.get(Calendar.YEAR); | |
int AM_PM = cal.get(Calendar.AM_PM); | |
// because fuckmin display incorrect | |
String fuckmin = ""; | |
if(min < 10) { | |
fuckmin = "0" + min; | |
} | |
else { | |
fuckmin = "" + min; | |
} | |
// because fuckmin display incorrect | |
String fucksec = ""; | |
if(sec < 10) { | |
fucksec = "0" + sec; | |
} | |
else { | |
fucksec = "" + sec; | |
} | |
// check valid if AM or PM | |
String day_night = ""; | |
if(AM_PM == 1) { | |
day_night = "PM"; | |
} | |
else { | |
day_night = "AM"; | |
} | |
// check date of a week | |
String nameofdate = ""; | |
if(dayofweek == 1) { | |
nameofdate = "Sunday"; | |
} | |
if(dayofweek == 2) { | |
nameofdate = "Monday"; | |
} | |
if(dayofweek == 3) { | |
nameofdate = "Tuesday"; | |
} | |
if(dayofweek == 4) { | |
nameofdate = "Wednesday"; | |
} | |
if(dayofweek == 5) { | |
nameofdate = "Thursday"; | |
} | |
if(dayofweek == 6) { | |
nameofdate = "Friday"; | |
} | |
if(dayofweek == 7) { | |
nameofdate = "Saturday"; | |
} | |
else {} | |
// check date of a week | |
String monthname = ""; | |
if(month == 0) { | |
monthname = "January"; | |
} | |
if(month == 1) { | |
monthname = "February"; | |
} | |
if(month == 2) { | |
monthname = "March"; | |
} | |
if(month == 3) { | |
monthname = "April"; | |
} | |
if(month== 4) { | |
monthname = "May"; | |
} | |
if(month == 5) { | |
monthname = "June"; | |
} | |
if(month == 6) { | |
monthname = "July"; | |
} | |
if(month == 7) { | |
monthname = "August"; | |
} | |
if(month == 8) { | |
monthname = "September"; | |
} | |
if(month == 9) { | |
monthname = "October"; | |
} | |
if(month == 10) { | |
monthname = "November"; | |
} | |
if(month == 11) { | |
monthname = "December"; | |
} | |
else {} | |
// Output full date and time | |
String fulldate = nameofdate + ", " + monthname + " " + date + ", " + year + " " + hour + ":" + fuckmin + ":" + fucksec + " " + day_night; | |
//Datedisplay.setText(fulldate); | |
Thread.sleep(1000); | |
System.out.println(fulldate); | |
} | |
catch (Exception e) { | |
System.out.println("fatal error fuck you bitch!!"); | |
} | |
} | |
}.start(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment