User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 456,195 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,943 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 719 | Replies: 2
Reply
Join Date: Feb 2007
Posts: 18
Reputation: aruna_k_2006 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
aruna_k_2006's Avatar
aruna_k_2006 aruna_k_2006 is offline Offline
Newbie Poster

is there any solution

  #1  
May 8th, 2007
import java.util.*;
import java.text.*;
class DemoDate
{
public static void main(String[] args)
{
Date date=new Date();
SimpleDateFormat sdf;
// sdf=new SimpleDateFormat("hh:mm:ss");
//System.out.println(sdf.format(date));
// sdf=new SimpleDateFormat("dd MMM yyyy hh:mm:ss zzz");
//System.out.println(sdf.format(date));
sdf=new SimpleDateFormat("E MMM dd yyyy hh:mm:ss");
System.out.println(sdf.format(date));
}
}





i am getting current date and time but i want to catch that time (as a login time 4 a person)in my jsp whenever i refresh i am getting current system time .Suppose i logged in at 2:00 that time should be there ...................plz help me
Nikki
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2006
Posts: 1,509
Reputation: masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light 
Rep Power: 10
Solved Threads: 136
masijade's Avatar
masijade masijade is offline Offline
Posting Virtuoso

Re: is there any solution

  #2  
May 8th, 2007
By assigning the date object to a session variable at login, then simply displaying that date at every other page load rather than creating a new date (as you are doing now). A new date object will always hold the current time at the time of construction (at least when created using the default constructor).
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote  
Join Date: Feb 2006
Posts: 1,509
Reputation: masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light 
Rep Power: 10
Solved Threads: 136
masijade's Avatar
masijade masijade is offline Offline
Posting Virtuoso

Re: is there any solution

  #3  
May 9th, 2007
Please don't send me personal messages about this. Keep the conversation here, so that anyone else with this type of question can also benefit.

Post your code here, and then we can continue.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JSP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 3:48 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC