Current Date

By #Warizardworks on Feb 24, 2010

Hey guys, it's WP (Wariopower).

I've been posting numerous mIRC Snippets for a while so I decided to post a snippet for the first time in a different language; that being Java. So, this is my first Java snippet and it's called Current Date. Ya know those times when you can't remember what the date is? Well this should help, hopefully. :P You can use a program like Eclipse or something of that sort to use it! Thanks guys, enjoy! =] EDIT: Fixed problems.
~ WP

~ This script was made by Wariopower of #WarizardWorks on irc.purplesurge.com ~

import java.util.Calendar;

   public class CurrentDate {

      public static void main(String[] args) {

      Calendar cal = Calendar.getInstance();

      int day = cal.get(Calendar.DATE);
      int month = cal.get(Calendar.MONTH) + 1;
      int year = cal.get(Calendar.YEAR);
      int dow = cal.get(Calendar.DAY_OF_WEEK);
      int dom = cal.get(Calendar.DAY_OF_MONTH);
      int doy = cal.get(Calendar.DAY_OF_YEAR);

    System.out.println("The Current Date is...: " + cal.getTime());

   }

}

Comments

Sign in to comment.
Sorasyn   -  Aug 02, 2010

Why set all those variables if they serve no purpose :/

      int day = cal.get(Calendar.DATE);
      int month = cal.get(Calendar.MONTH) + 1;
      int year = cal.get(Calendar.YEAR);
      int dow = cal.get(Calendar.DAY_OF_WEEK);
      int dom = cal.get(Calendar.DAY_OF_MONTH);
      int doy = cal.get(Calendar.DAY_OF_YEAR);
 Respond  
#Warizardworks   -  Feb 28, 2010

Thanks hello2u, I'm glad it finally works. :D
WP

 Respond  
hello2u   -  Feb 28, 2010

:>
It's fixed, good job WP.

 Respond  
hello2u   -  Feb 28, 2010

well, I went ahead and looked it up- the constructors are declaired as protected- meaning they can only be accessed by the class or a subclass..... I have no idea why it is like that, or how to get around it.
Perhaps you should try a better Class?
...
and compile before posting it... (I'm still not sure where you are writing it, but Eclipse is probably best.)

 Respond  
#Warizardworks   -  Feb 26, 2010

Very odd, it should reconize it... I'll look into it.

 Respond  
hello2u   -  Feb 26, 2010

Wariopower: my compiler still doesn't recognise the calendar constructor... don't know why.
Caveman: please come into #warizardworks for help on that, looks complicated 0.0

 Respond  
CaVeMaN   -  Feb 25, 2010

looks like you guys can help me ..i need the nick completions to apears anywhere in the text im writing and not only at the begining (default)..here is the part i thing it has to be change ..
/corrige.nicks {
if ( $right($1,1) = : ) {
%nc = 0
%nn = $nick(#,0)
:1
inc %nc 1
if (%nc > %nn) goto 3
%nac = $nick(#,%nc)
%ntm = $len(%nac)
%nsf = $ncmuestra(%nac)
%npart = $remove( $1 ,:)
if (%npart isin %nac) {
%texto = %nsf $+ $right(%texto,$calc($len(%texto) - $len($$1)))
goto 3
}
else { goto 1 }
:3
unset %nac %ntm %nsf %nn %nc %npart
}
elseif ($$1 ison #) {
; %texto = $replace(%texto,$$1,$ncmuestra($nick(#,$nick(#,$$1))))
%texto = $ncmuestra($nick(#,$nick(#,$$1))) $+ $right(%texto,$calc($len(%texto) - $len($$1)))
}
}
ncmuestra {
return $+ %nc1.c $+ $+ %nc1 $+ [ $ $+ [ texto $+ [ %ncnick ] $+ ($$1) ] ] $+ $+ %nc2.c $+ $+ %nc2 $+
}

 Respond  
#Warizardworks   -  Feb 24, 2010

Yeah, my mIRC brain is taking over into the Java world.

EDITED SNIPPET with corrections, thank you hello2u. =]
~ Wariopower

 Respond  
hello2u   -  Feb 24, 2010

... Just realised..... that shouldn't work lol
the variables aren't initialized....
loads into eclipse
EDIT: Also comments are // or / /, not ; lololololol
mIRC on the brain you have?

 Respond  
hello2u   -  Feb 24, 2010

there's no bots on #warizardworks lol.
and waroppower: I know much more advanced Java if you'd like :p
AP Java ftw

 Respond  
#Warizardworks   -  Feb 24, 2010

Yeah and yeah lol, my computer with mIRC fails so, I haven't been on in a while. :P
~ Wariopower

 Respond  
D2K7   -  Feb 24, 2010

And your channel on there has no one but, me and some bot in Lawllllllll

 Respond  
D2K7   -  Feb 24, 2010

Java, has it's own current date identifier....

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.