Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_java thread: Problems working with Date and Time


Message #1 by "Dima" <difrad76@y...> on Fri, 1 Jun 2001 01:29:41
import java.util.*;
import java.text.*;
public class sumandate
{
public static void main(String args[])
{


Date date = new Date();
SimpleDateFormat df;


df=new SimpleDateFormat("dd/MM/yyyy/hh:mm:ss");
String dat=df.format(date);
System.out.println(" " + df.format(date));
}
}



for time being you can work with this code.Because i did some project by this code.If u want particular date and time for particular
place then u wait for some time as i am bussy.


suman



pro_java@p... wrote:



Try the following code and note that the
getDateTimeInstance() signature. 

import java.util.*;
import java.text.*;

public class DateTime{

public static void main( String args[]){

String tt=new String(); // String that will hold
results

Date today=new Date(); //date type variable
DateFormat
fmt=DateFormat.getDateTimeInstance(DateFormat.FULL,
DateFormat.FULL, Locale.US);
/*formating
date and time */
tt=fmt.format(today); // parsing date to string
System.out.println(tt);
}
}

  Return to Index