on 01-07-2009 2:00 PM
hi,
i am setting the current date in WD Java using the following code:
java.util.Date today = new java.util.Date();
java.sql.Date sqlToday = new java.sql.Date(today.getTime());
wdContext.currentContextElement().setmydate(sqlToday);
it is functioning correctly.
my question is:
How to set the current time?
Regards
Adnan
Hi,
wdContext.currentContextElement().setmydate(new Date (System.currentTimeMillis())); //--This will give you current date.
Calendar cal = Calendar.getInstance();
cal.getTime() ; //---- This will give you time.
Edited by: Swati Gaur on Jan 8, 2009 11:32 AM
Edited by: Swati Gaur on Jan 8, 2009 11:34 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use this method.
System.DateTime.Now.ToShortTimeString
Regards,
Sunaina Reddy T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Adnan,
To get the current time you can use the below code
Calendar cal = Calendar.getInstance();
cal.getTime();// This will give you current time
Now if you want to print the date in desired format then you can use below mentioned code.
SimpleDateFormat sdf = new SimpleDateFormat("dd MMMMM yyyy");
String Date = sdf.format(cal.getTime();
Hope this will help
Regards
Narendra Singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
wdContext.currentContextElement().setmydate(System.DateTime.Today.TimeOfDay.ToString());
if not use
System.DateTime.Now.ToShortTimeString
Regards,
Srikanth Reddy.T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use Below Code for setting a time & date
SimpleDateFormat fSDateFormat = null;
fSDateFormat = new SimpleDateFormat ("EEE, d MMM yyyy HH:mm:ss Z");
java.util.Date now = new java.util.Date ();
String date_out = fSDateFormat.format (now);
wdContext.currentContextElement().setmydate(date_out);
Regards,
P.Manivannan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Adnan,
Convert is from date to string :
String bldate=item.getBilling_Date();
String byy=bldate.substring(0,4);
String bmm=bldate.substring(4,6);
String bdd=bldate.substring(6,8);
String bdate=byy+"-"+bmm+"-"+bdd;
java.sql.Date bildate=java.sql.Date.valueOf(bdate);
elem1.setBilling_Date(bildate);
Regards
Khushboo
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.