How to set Timezone in a date object
Hi,
I need to write a method setTimeZone(Date d,TimeZone t) which should take a Java.util.Date and a Timezone object and set the time zone to the date object.
for example...
Date d=new Date();
TimeZone tz=TimeZone.getTimeZone("PST");
//should print the timezone as EDT because the current system timezone is EDT
System.out.println(d);
setTimeZone(d,tz);
//should print the timezone as PST
System.out.println(d);
public void setTimeZone(Date d,TimeZone tz){
Calendar c=Calendar.getInstance(tz);
c.setTime(d);
c.setTimeZone(tz);
d=c.getTime();
System.out.println("Timezone in calendar is "+c.getTimeZone().getDisplayName());
But today is still showing up EDT timezone and Timezone in calendar is shown as PST.The new timzone is not aplied to date object @ d=c.getTime();
statement.
Could any one please help me...
Edited by: mchepuri on Apr 10, 2009 7:27 PM
Edited by: mchepuri on Apr 10, 2009 7:29 PM
Dates don't have any concept of time zones. Think of a Date as a wrapper for a long.
Use SimpleDateFormat. Read the javadocs for some useful methods.
Similar Messages
-
How to set execution preferences between Data Objects
Hi Experts,
I have 2 data Objects(one Bidrectional and another Upload Only) in my SWCV and according to my requirement i have to execute first DO(Bidirectional) before execution of Second DO(Upload Only).
Is there any way so that i can set execution preferences between these two DOs.
Regards,
AbhishekHi Liji,
Execution preference is more related to the "Semantic Compression" capability of the application/framework than the "backward compatiblity" with 04/04s.
Whenever the semantic compression is enabled, sync order has to be present for the set of data object to ensure the correct order of the data going to the server.
As all the backward compatible applications are "Semantic compression enabled" this option is mandatory for those applications.
But non-backward compatible applications might also want to use "semantic compression" feature to reduce the traffic over the network. In this case, those applications will also need this feature. Hence this feature of settting the sync order is available for all the SWCVs.
Regards,
Ramanath. -
How to set page number & current date in sqlplus result
how to set page number & current date in sqlplus result
Hi,
Use the TTITLE command. For example:
SET PAGESIZE 15
TTITLE LEFT &_date RIGHT "Page:" FORMAT 999 sql.pno SKIP 2
SELECT ROWNUM
, ename
FROM scott.emp
;Output:
12-Jan-2011 Page: 1
ROWNUM ENAME
1 SMITH
2 ALLEN
3 WARD
4 JONES
5 MARTIN
6 BLAKE
7 CLARK
8 SCOTT
9 KING
10 TURNER
12-Jan-2011 Page: 2
ROWNUM ENAME
11 ADAMS
12 JAMES
13 FORD
14 MILLER
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and the results you want from that data. If your question is based on commonly available tables, like those in the scott schema, then you don't have to post any sample data: just post the output.
Explain how you get those results from that data.
Always say what version of Oracle (and other relevant softward, SQL*Plus in this case) you're using. -
How to set default value to date type attribute.
Hi,
How to set default value to date type attribute.
E.g I want to set u201C01/01/1999u201D to date attributes.
First i want to set value and then i want to fetch the same & want to check equals.
please suggest solution.
Regards,
SmitaHi,
In wdinit() method u can set the date
DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
Date today = Calendar.getInstance().getTime();
String reportDate = df.format(today);
wdContext.currentContextElement().setFromDate(reportDate);
Another way you have set the this formate like that
1. Create a Simple type under "Dictionaries->SimpleType" called DateFormat
2. Select the type as "date"
3. Go to the "Representation" tab and set the format as "dd/MM/yyyy" (or whatever u want, but month should be MM)
4.Bind the context attribute to the type created now.
Hope this helps u.
Best Regards
Vijay K -
ADF How to Set TimeZone in adf-faces-config.xml
hi
How to set timezone in adf-faces-config.xml .Valid ID for a java.util.TimeZone should be supported.
See also http://java.sun.com/j2se/1.5.0/docs/api/java/util/TimeZone.html -
how to use ADO(Microsoft ActiveX Data Objective 2.8 Library) to execute the store procedure of database in SQL server?
Does any body can tell me about this?
thanks
[email protected]Hi
Did you succeed to execute the procedure?
How ?
Thanks
Shimon Zerbib -
Help Please: how to set JDBC properties for data encryption in BC4J
Hello,
I am trying to implement JDBC Thin Driver Support for Data Encryption and Integrity.
With java.sql.Connection and java.util.Properties, one would do something like the following code:
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Properties props = new Properties();
int level = AnoServices.REQUIRED;
props.put("oracle.net.encryption_client", Service.getLevelString(level));
props.put("oracle.net.encryption_types_client", "( RC4_40 )");
props.put("oracle.net.crypto_checksum_client",Service.getLevelString(level));
props.put("oracle.net.crypto_checksum_types_client", "( MD5 )");
Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@localhost:1521:main", props);
But, how can we do this with BC4J objects? Can we set this properties via EnvInfoProvider class? Please help. Thank you very much in advance.
ZhirongHi,
Try adding the code in the PBO part of your custom program used for the custom screen which you have created and added inside the BADI.
Regards,
Harish -
How to set the default display date of Calender prompt of SMPortal???
Good Day!!
As for as my knowledge, the default date Visible in all Calender prompt will be the
Starting Date in the Specified date range either "RelativeDateRange" or "AbosoluteDateRange".
But we have a requirement to set the default date to a date in the middle of the specified range, I don't find any option to specify in Request Offering Wizard or MP's xml file.
Our scenario is as follows,
We are trying to customize the CSPP's request offer "Request Virtual Machine", which has a user promt to select Decommission Date for the New VM. We have configured the date prompt as Relative Date range and set the
Start date as "1 day next to user's current time" and Maximum date to "90 days after relative date". So the user will get option to select Decomm date from (1-90) days with the defalut date as 1st day next to his current
time. But our requirement is to set the default available date as 90th date in the above mentioned Relative Date Range.
I couldn't find any option in Request offering Wizard as attached below,
Also I couldn't even find any tag to specify the default display date in the MP's XML file as attached below. Is there any other <tag> can be included inside <Details> tag to accomplish this ??
Is there any other way to accomplish this???
Please advise
Thanks,
Narayanababu
Thanks and Regards, Narayana BabuThis is probably a link editor parameter, see the linker and loader guide.
Another thing you can do is write your own sbrk() that will log whenever it's called, so you can at least see how many times it's called and with what values. If you really need in-depth instrumentation, write your own heap routines and give them the same names as the CRTL routines. The linker should find yours first and route all memory operations through them. At least, that's the way it worked for me on SunOS 4.1.... -
How to populate BAM 11g TP4 data objects directly from jms?
Anyone knows how to do it? Is there any step by step document for this? Any help will be apreciated.
tksFor a JMS Message that looks like:
==================================
<PRE><Salesperson>ABCD 5555</Salesperson><SalesArea>gamma</SalesArea><SalesNumber>1000</SalesNumber><Timestamp>2007-06-07T08:10:00</Timestamp></PRE>
Data Object being used here:
=======================
/Samples/Employees -- can be viewed using Architect
Create EMS:
===========
Open BAM Architect and select Enterprise Message Source from the drop down list.
Click Create.
EMS Details
Name : TestEmployees
InitilContextFactory : oracle.j2ee.rmi.RMIInitialContextFactory
JNDI Service Provider URL : ormi://localhost:23791/
Topic/Queue Connection Factory Name : jms/QueueConnectionFactory
Topic/Queue Name : jms/demoQueue
JNDI Username : fmwadmin
JNDI Password : welcome1
JMS Message Type : Text Message
Durable Subscriber Name (Optional) : <Leave blank>
Message Selector (Optional) : <Leave blank>
Data Object Name : /Samples/Employees
Operation : Insert
Batching : No
Transaction : No
Start when BAM Server starts : Yes
JMS Username (optional) : <Leave Blank>
JMS Password (optional) : <Leave Blank>
Pre-Processing checkbox : unchecked (as we do not have any XSL Transformations).
Message Element Name : PRE
Namespace Qualified checkbox : unchecked.
Message Batching checbox : unchecked.
Column Value : Select Attribute.
DateTime Specification checkbox :unchecked.
Source to DataObject Field Mapping:
Click Add and enter names for the Tag/Attr Name corresponding to the Dataobject Field.
Example: Salesperson(from the JMS Message xml) maps to Salesperson (Dataobject Field).
Click Save.
Click Continue.
Click Start and the EMS should start correctly.
Now if you send the JMS message, you should see that DataObject ("/Samples/Employees") is updated with the new row of data. -
How to convert a string to date object?
I have a string user input for date.
I want to convert it to Date object to insert it in database.
How to do it?Check the java.text.SimpleDateFormat class. You can use it for parsing dates. API contains good description how to build the format pattern.
HTH
Mike -
How to create a java.util.Date object from a date String?
How do I convert a String representation of a date in for the format dow mon dd hh:mm:ss zzz yyyy (e.g. "Mon Aug 27 17:12:59 EDT 2001") into a Date object? This you might note is the output of the Date classes toString() method. I don't want to have to parse this string. Thanks!
Try this out
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd");
String d = "19990831";
Calendar cal = Calendar.getInstance();
cal.setTime(sdf.parse(d));To create the SimpleDateFormat with a diffrent format check out all the possibilities here
http://java.sun.com/j2se/1.3/docs/api/java/text/SimpleDateFormat.html
Hope this helps
Regards
Omer -
How to set updatable property of view object on runtime
Hello Gurus,
I am new in adf and using jdev 11.1.2.3.
I have two view object which has view link and they are based on entity object. In master view i have a column with the name of status. The target is if the value of status is 'active' then i want to allow add rows in detail view and if it is inactive then wants to disable adding or editing in the detail view.
I don't know how to do this. I don't know how to get the other view object and how to set update able property and where to write code in entity object class or view object class.
Any advice................
Thanks in AdvanceThere are multiple possible ways to archive this. As the VOs are in a master-detail relationship, you can opt to add a navigation method to the child back to the parent. This method can be accessed via java or groovy to allow the child access to the master row. Once the child has access you can use this to ask the master for it's status and if it's not active disable the edit and update buttons.
If both master and detail are on the same page in the ui, there is an easier way. Drag the status attribute from the master table onto the page as e.g. inputText. This will create a binding for the attribute which changes if you select a row in the master table. As you don't need to inputtext, switch to the source mode of the page and delete it. This will remove the inputtext put keep the binding. Now you can use hte binding in an EL to set the disable property of other components to true like
<af:commandButton text="commandButton 1" id="cb1" disabled="#{bindings.masterstatus.inputValue ne 'active'}"/>
The button will only be active it the binding for masterstatus is active.
Timo -
How to set the Valid-to-date (datub) of a BOM item
Is there a way I can set the "Valid-to-date" of a BOM item?
According to SAP documentation...
Quote
<i>"If you change a BOM using a change number, the system determines the valid-to date dynamically."</i>
Unquote
I want to "expire" a BOM item. Meaning I want to set the valid-to-date to a date in the past.
Is this possible at all?
Thanks for any input.
FredFerry,
Thanks for you reply.
I do not see a field for the "Valid-to" date in the function module - CS_BOM_EXPL_MAT_V2. There is one for the "Valid-From" date called DATUV. But I would like to change the "Valid-from" date of the BOM item.
Or is there another way to set the BOM item's valid-to date using this function module which I am missing?
Fred -
How to export & import interface type data object to memory
Hi experts,
My greetings to all.
we have came across a situation where we need to pass interface type data object to memory
and import same from memory.
DATA context TYPE REF TO if_timecontext.
its not possible with regular export statement.
is their any other way to do it?
Thanks in advanced,
SudhirThank you saurabhmani & sandra.
@ saurabhmani : i tried assigning object context to memory (field-symbol) and exporting it to memory, but got runtime error.
@sandra : XML serialization & shared object concept sounds intresting but as you already checked that interface IF_TIMECONTEXT is missing the required IF_SERIALIZABLE_OBJECT interface.
Istead of exporting context data object to memory we tried different approch and it worked out for our requirement
Regards
Sudhir -
How to set alarm for same date every month??
Is there a way (or an app) that will allow me to set an alarm for the 29th of every month?
It's not an alarm per say but how about setting up a repeating appointment in the calendar app with an alert?
Maybe you are looking for
-
How to use the same button to control run or stop of the program?
I want to run a program when I press Boolen2, I use switch when press. So when I press it, it will turn "on" stature. There is a loop in the program. I want to stop it, when press the button again, that is when make the button from "on" statue to "of
-
I have recently purchased a new laptop with Windows 7 (64 bit) and Outlook 2010 which I use for email, contacts and calander. I have managed by a miracle using bluetooth to synch between my Tungsten E2 and Palm desktop and know that there are no too
-
my computer shut down and with help from Appel it turned out that I had to erase everything . Now I only have my music from my CDs on my iPod. And no longer in iTunes as before. I do not have backup :-( How do I save all the musicfrom the iPod on the
-
what is the meaning of e system- jvm:infop=25a84f41,a='7.1.0.746',0='9.50.0.80',h=e000f03 when i press alt+L+G+L+G on my bb 9220 i have that situation,but when i press alt+L+G+L+G on the other device i come different situation.what i must to do?
-
Hi All, In production sometimes a data load fails because of the less ABAP memory available. For a perticular load ABAP memory goes till 4 Gb and more and after that load fails with short dump. This time i change a start routine logic and split a co