Warning: Invalid argument supplied for foreach() in /home/e1rsbco/public_html/hafriz/wp-content/plugins/facebook-import-comments/classes/FacebookCommentImporter.php on line 185
Your browser (Internet Explorer 6) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.
X
Post

simpledateformat

fuh.. ari ni saja posting aku yang ke 3 untuk tutorial. bukan ape, sebenarnya posting-posting tu adalah posting tertanguh yang memang aku nak post pun, tapi tak sempat.

ok. korang mesti akan bermain dengan time dan date kan? so post kali ni mudah aje, camne korang nak paparkan current date and current time mengikut sistem yang korang tengah guna skarang.

camne? mudah aja…

aku create satu java class bernama function then aku letak semua function-function yang tak berkaitan dengan mana-mana object (sebab aku malas nak create class untuk object yang kecik satu-satu kekeke) so kat bawah ni aku buat satu method getCurrentTime(). so dibawah ni adalah file dalam function.java aku

package temuduga;
import java.util.*;
import java.util.Calendar;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.text.ParseException;

public class function {

public String getCurrentDateTime(){
String today = new SimpleDateFormat(“dd/MM/yyyy”).format(new Date());
return today;
}

}

then next apa yang aku letak kat jsp aku

<head><jsp:useBean id=”fungsi” class=”temuduga.function”/></head>

Current Date And Time : <%= fungsi.getCurrentDateTime() %>

Related posts:

  1. JSP tutorial + mysql part II
  2. sending mail using jsp
  3. string kepada format date
  4. JSP tutorial
  5. fetch database guna join

Leave a comment  

name*

email*

website

Submit comment