Converting Object to a Date
Hey guys some one help me out..
1) How to convert Object to Date and
2) Date to a String in a specified format like "MM : DDD : YYYY".
Thanks in Advance :-)
Thanks guys.. I got it.
Similar Messages
-
Converting Info-Objects as a Data Targets.
Hi All,
I Converted some info objects as a Data targtes in my Dev box, I need to affect those changes in my QA box and Production box, So that i need to transport those changes, I saved the changes in one Trasport req in Dev,
So if i trasport the same req to QA box, is the only changes will affect or the complete info object will affect...
note: i have master data stored in all my objects in all environments....
I will assign points.Hi Bhanu,
Thanks for your earlier reply,
I saved my changes in a single TP req, in this req it shows all my info objects,
Iam thinking when i transport the req it should affect the info-object which it has been used in Cubes and ODSs..
So can you tell me in details plzz -
How can i convert object to byte array very*100 fast?
i need to transfer a object by datagram packet in embeded system.
i make a code fallowing sequence.
1) convert object to byte array ( i append object attribute to byte[] sequencailly )
2) send the byte array by datagram packet ( by JNI )
but, it's not satisfied my requirement.
it must be finished in 1ms.
but, converting is spending 2ms.
network speed is not bottleneck. ( transfer time is 0.3ms and packet size is 4096 bytes )
Using ObjectOutputStream is very slow, so i'm using this way.
is there antoher way? or how can i improve?
Edited by: JongpilKim on May 17, 2009 10:48 PM
Edited by: JongpilKim on May 17, 2009 10:51 PM
Edited by: JongpilKim on May 17, 2009 10:53 PMthanks a lot for your reply.
now, i use udp socket for communication, but, i must use hardware pci communication later.
so, i wrap the communication logic to use jni.
for convert a object to byte array,
i used ObjectInputStream before, but it was so slow.
so, i change the implementation to use byte array directly, like ByteBuffer.
ex)
public class ByteArrayHelper {
private byte[] buf = new byte[1024];
int idx = 0;
public void putInt(int val){
buf[idx++] = (byte)(val & 0xff);
buf[idx++] = (byte)((val>>8) & 0xff);
buf[idx++] = (byte)((val>>16) & 0xff);
buf[idx++] = (byte)((val>>24) & 0xff);
public void putDouble(double val){ .... }
public void putFloat(float val){ ... }
public byte[] toByteArray(){ return this.buf; }
public class PacketData {
priavte int a;
private int b;
public byte[] getByteArray(){
ByteArrayHelper helper = new ByteArrayHelper();
helper.putInt(a);
helper.putInt(b);
return helper.toByteArray();
but, it's not enough.
is there another way to send a object data?
in java language, i can't access memory directly.
in c language, if i use struct, i can send struct data to copy memory by socket and it's very fast.
Edited by: JongpilKim on May 18, 2009 5:26 PM -
Convert Char. to Master Data
Hello Experts,
I have a char. in the system. And I would like to convert it to master data. Because I am going to add to an attribute.
What should I do?Hi ,
1- Go to Transaction RSD1 and Enter the technical name of your Info Object and select the change option .
2- go to Master Data/ Text Tab of Info object .
3- Select the check box With Master Data and if you need text of master data then select the With Texts check box also .
You can select short ,medium and long text as per your need .
4- Now you can see that Attribute Tab has been appeared for the Info object . You can enter display or navigation attribute as per your requirement .
Do not forget to re-activate the info object again .
Note : If your object is already used in Info provider , system will not allow to make above changes . So First remove it from Info provider and then do this changes .
Hope it helps .
Regards
Vikas Sharma
Robert Bosch -
How to convert from line chart data to CSV format
Hi ,
I am using Flex 3 and AS.
I am getting data from MS SQL and display the data as line
chart this is ok.
But i want to convert this line chart data to CSV or .xsl
format.I find one example in fourms the from data grid to CSV
For this URL is
http://www.abdulqabiz.com/blog/archives/flash_and_actionscript/datagriddataexporter.php
But i want Line chart to CSV.Please help me.Line chart is a just a visual representation of some data
that's sitting in your database. Isn't it? You load this in Flex,
probably using HTTPService class, and pass it to some chart object.
Now when use says that she needs it in CSV format, you're
gonna have to send another request to the server to produce the
same data, convert into CSV or XLS format and let user download it.
Of course, if use doesn't want to download, you don't have to
go to the server, at least for CSV format. You can convert the same
data that used plot the chart to convert to CSV.
Am I missing something here?
ATTA -
Problem in converting the String to Date with time zone GMT
Hi,
When I tried to convert the string 12/05/2009 to Date, the time zone is set to BST.On the other hand, for the date 12/12/2009, the time zone is set to GMT. What should I do to get the time zone as GMT all the time.?
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
String dateString = "12/05/2009";
System.out.println(myDate.toString());I think you are all missing the point. java.util.Date objects always alway always store the date as the number of milliseconds since 1/1/1970 UTC so the only TimeZone they have its the implicit UTC. When you use the Date.toString() method the toString() method gets the default time zone from your environment and formats the data accordingly. This means that the same Date object will, by default, produce a different result for France and Australia and the US.
So, if you have the date "12/5/2009" as a String then to convert it to a java.util.Date you must specify what TimeZone is implied. If it is your system time zone then you can just create a SimpleDateFormat object with the correct format and then use the parse() method to create the java.util.Date object and this will automatically be converted to UTC. If the date String represents some other time zone then you must explicitly set the time zone of the SimpleDateFormat object before parsing the string.
The same approach applies when converting a java.util.Date object to a String. If you want anything other than your system time zone then you must explicitly tell the SimpleDateFormat what time zone you want the result formatted for. -
How can I convert from Modbus raw data to engineering units using a formula?
Within Lookout, I have several Modbus numerical input types that do not have a linear corespondence to the Engineering values they represent. How can I display these values accurately using a formula to convert from the raw data to an engineering value?
I don't quite understand your reply. I'm using Lookout 6.0.2, logged in as Administrator, in Edit Mode. The Modbus object is named RTU06_SAV. The Active member is 30002 with an alias of SAVfmSMT_RSL.
Following your instructions, I opened Object Explorer and right-clicked on RTU06_SAV.
This opened a menu containing: Refresh, Cut, Copy, Rename, Delete, Edit connections..., Edit Data Member Configuration, Configure Network Security and Properties.
I assumed that I should select Edit Data Member Configuration, but maybe I'm wrong.
Within Data Member Configuration I can set up Linear Scaling between Raw data and Engineering data. I know how to do that, but what I need to know is how to convert Raw data to Engineering data using a formula representing a non-linear transformation (such as a converion to a logarithmic value or perhaps a formula derived by fitting the formula to a curve on a calibration chart).
Once I have this my Engineering data can be represented on a control panel as both a numeric value AND as a correctly reading Gauge. It can also be properly represented on a HyperTrend graph.
What do you suggest? -
hi all,
i have a date in string format Tue, 06 Feb 2007 12:38:17 GMT
How do i convert it to sql datetime.
Date date = new Date("Tue, 06 Feb 2007 12:38:17 GMT");// creating date
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");// format definition
java.sql.Time pubDate = java.sql.Time.valueOf(sdf.format(date));
System.out.println(pubDate);This code gives me java.lang.NumberFormatException.
Thanks in advance.......
VikraMis "EEE d MMM yyyy HH:mm:ss Z" your default data format
if not your first constructor will not parse date properly so your date object contains invalid date, when you try to format it it throws exception.
check it
sudhir nimavat -
How to convert a string to date and then compare it with todays date???
Hello.
I want to set a format first for my dates
DateFormate df = new SimpleDateFormate("yyyy-mm-dd");
once this is done then I want to convert any string to date object in the above formate
String str="2001-07-19";
Date d = null;
try{
d = df.parse(s);
}catch(ParseException pe) {
pe.printStackTrace();
First of all there is something wrong above,cus what I get for this is
Fri Jan 19 00:07:00 MST 2001
where as it should have been
2001-07-19... to my understanding.
once this part is done I need to get current date in the above set format and compare the
current date and the date I set.
I will appreciate the help.
Thanksfor the output part:
a date is a point in time
the output depends on the format you specify for output
using for example a SimpleDateFormat.
You only specified the format for parsing (which is independent for that of output) so java uses some default format ... see the DateFormat.format() method for details.
for the comparison stuff, I just posted a little code snippet in this forum a few minutes ago.
the hint is: Date.getTime() returns milliseconds after a fixed date
hth Spieler -
Convert Solar Hejra(Hijri) date to Anno Domini date
Hi everyone:
I am developeing an application cfm format. The company has
some paper forms that the dates are in Solar Hejra(Hijri) date
format and I need them to be converted into Anno Domini date. Do
you know any solution/tutorial or ready_to_use code in cfm format?
Or if it is not avaiable what do you seggest? I use some javascript
code? Do you know one that does it for me?
Thanks
BenignBenign wrote:
> Hi:
> Thanks for the fast reply.
> I will work on and try to make a neat convertor but do
you know any
> ready_to_use convertor? The one that only converts
Persian Date into Gregorian
> Date it is all I need.
that *is* a ready to use convertor. to convert the islamic
calendar dates to
gregorian (well to cf datetime objects) you use the
i18nDateParse function. you
can ignore the rest of the methods in that CFC (though if you
deal w/this sort
of thing once, you'll likely deal with it again). the only
tricky bit is knowing
if the original islamic dates are based on civil or religious
calendars. -
Difference between Service data objects and process data object
Hi
Can anybody tell me what is the difference between SDO (Service Data Objects) & PDO (Process Data Objects).I am using 2 port PCI-CAN series 2 card.
If anybody knows the answer then please reply.
Thanking YouHi,
See the online help file from our NI CANopen Library for LabVIEW for some basic informations about SDOs and PDOs.
More information should be available from the web.
DirkW
Attachments:
lvcanopenvhelp.zip 154 KB -
Converting object wrapper type array into equivalent primary type array
Hi All!
My question is how to convert object wrapper type array into equivalent prime type array, e.g. Integer[] -> int[] or Float[] -> float[] etc.
Is sound like a trivial task however the problem is that I do not know the type I work with. To understand what I mean, please read the following code -
//Method signature
Object createArray( Class clazz, String value ) throws Exception;
//and usage should be as follows:
Object arr = createArray( Integer.class, "2%%3%%4" );
//"arr" will be passed as a parameter of a method again via reflection
public void compute( Object... args ) {
a = (int[])args[0];
//or
Object arr = createArray( Double.class, "2%%3%%4" );
public void compute( Object... args ) {
b = (double[])args[0];
//and the method implementation -
Object createArray( Class clazz, String value ) throws Exception {
String[] split = value.split( "%%" );
//create array, e.g. Integer[] or Double[] etc.
Object[] o = (Object[])Array.newInstance( clazz, split.length );
//fill the array with parsed values, on parse error exception will be thrown
for (int i = 0; i < split.length; i++) {
Method meth = clazz.getMethod( "valueOf", new Class[]{ String.class });
o[i] = meth.invoke( null, new Object[]{ split[i] });
//here convert Object[] to Object of type int[] or double[] etc...
/* and return that object*/
//NB!!! I want to avoid the following code:
if( o instanceof Integer[] ) {
int[] ar = new int[o.length];
for (int i = 0; i < o.length; i++) {
ar[i] = (Integer)o;
return ar;
} else if( o instanceof Double[] ) {
//...repeat "else if" for all primary types... :(
return null;
Unfortunately I was unable to find any useful method in Java API (I work with 1.5).
Did I make myself clear? :)
Thanks in advance,
Pavel GrigorenkoI think I've found the answer myself ;-)
Never thought I could use something like int.class or double.class,
so the next statement holds int[] q = (int[])Array.newInstance( int.class, 2 );
and the easy solution is the following -
Object primeArray = Array.newInstance( token.getPrimeClass(), split.length );
for (int j = 0; j < split.length; j++) {
Method meth = clazz.getMethod( "valueOf", new Class[]{ String.class });
Object val = meth.invoke( null, new Object[]{ split[j] });
Array.set( primeArray, j, val );
}where "token.getPrimeClass()" return appropriate Class, i.e. int.class, float.class etc. -
Gurus,
It would be highly appreciable if you could help me in knowing how to convert a string to date in obiee. I know we need to use CAST function. I don't have enough material to figure it out myself.
Awaiting a reply.
Thanks.Nico - Thanks for the link, this is very helpful. Please tell me what's wrong in the following code. Am enlcosing the code and the error.
Code 1 :
CAST(CAST('31-OCT-'||CAST(YEAR("Dim - MBS Loan"."CLOSING DATE") AS CHAR) AS CHAR) AS DATE)
Error 1:
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 25137, message: ORA-25137: Data value out of range at OCI call OCIStmtExecute: select distinct D1.c1 as c1, D1.c2 as c2, D1.c3 as c3,
Code 2 :
CAST('31-OCT-'||SUBSTRING(CAST(YEAR("Dim - MBS Loan"."CLOSING DATE") AS CHAR),3,2) AS DATE)
Error 2:
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 1840, message: ORA-01840: input value not long enough for date format at OCI call OCIStmtExecute: select distinct D1.c1 as c1, D1.c2 as -
Error when converting time stamp in date time time zone CST in IC
Hi Experts,
We have recently upgraded from CRM 5.0 to CRM 2007. We are using IC WEB Employee interaction center.
so when agent create service ticket in interaction center and close the ticket on same day we are getting an error saying Error when converting time stamp in date time time zone CST.
we thought there may be problem while installing SAP CRM by basis team in time zone, but we did not find any problem.
So please advice how to resolve this issue.
Regards,
TejaHi Teja,
I saw a similar message, and it was resolved by adding a timezone to the user profile defaults tab in SU3. I believe the system has been configured to convert between users' timezone and the system timezone, therefore it needs to know each users' timezone.
Regards,
Simon. -
Cannot convert from java.util.Date to java.sql.Date
In the below code am trying to get the current date and 60 days prior date:
Date todayDate;
Date Sixtydaysprior;
String DATE_FORMAT = "MM/dd/yy";
DateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
Calendar cal = Calendar.getInstance();
todayDate = sdf.parse(sdf.format(cal.getTime()));
cal.add(Calendar.DATE, -60);
Sixtydaysprior = sdf.parse(sdf.format(cal.getTime()));I have imported following files:
<%@page
import="java.util.Calendar,
java.text.SimpleDateFormat,
java.text.ParseException,
java.util.*"
%>Shows up following error msg:
Type mismatch: cannot convert from java.util.Date to java.sql.Date
Thanks.
Edited by: MiltonDetroja on May 22, 2009 11:03 AMShows up following error msg:
Type mismatch: cannot convert from java.util.Date to java.sql.Date
I don't think this exception is thrown from the portion of code you have shown. As clearly specified in exception message, you cannot cast an instance of java.util.Date to java.sql.Date. you will need to do something like this
java.util.Date today = new java.util.Date();
long t = today.getTime();
java.sql.Date dt = new java.sql.Date(t);
Maybe you are looking for
-
Can I make an external Hard Drive my boot drive
My internal hard drive is about to die, it is making strange grunging noises and the computer is taking up to 30 minutes to boot up. The internal disk is the original 10GB disk with 9.7GB on it. I constantly get boot disk nearly full warnings. So I b
-
How do I convert a utube video to .flv to put in Flash
I have to embed a utube video from the 1960's into a website for my client. How do I do this.? I c'ant seem to access Adobe Media Encoder to convert to .fla. If I can convert t .fla I can make into a swf file using Flash cs5.
-
Does the graphic card in the PowerBook 12" supports OpenGL applications? If not, what are my options?
-
Call function in a constructor
Hello It is OK if I want to call a function inside a contructor For example: class A public A{ function a(); function a() Thank you sho
-
Activation of Business Content Datasources in CRM Source system
Hi, My Requirement is to activate all Datasources in CRM Develoment server.I have select the entire node in RSA5 and click "Activate Datasources".But for each Datasources system is askin for develoment request.Is there any procedure to activate