How to convert DateField date to String ?
Hi,
I'm trying to convert DateField date to String.
How can I do it because Data class does not have String converting
methods...
Thanks
Krzysztof
Hello,
you can get an instance of Calendar and use it with the date as a long integer.
public Calendar cal=Calendar.getInstance();
myDate=dateField.getDate();
cal.setTime(myDate);
myDateString=cal.get(Calendar.DATE)+"."+cal.get(Calendar.MONTH)+"."+cal.get(Calendar.YEAR));
Try it.
Unfortunately I have found that the MIDlet get a day less when I use the same long integer that I got from an application on PC. I don't realy understand why but I' still searching.
I hope it is usefull for you.
ValeriuS
Similar Messages
-
How to convert BLOB data into string format.
Hi,
I have problem while converting blob data into string format.
for example,
Select dbms_lob.substr(c.shape.Get_wkb(),4000,1) from geotable c
will get me the first 4000 byte of BLOB .
When i using SQL as i did above,the max length is 4000, but i can get 32K using plsql as below:
declare
my_var CLOB;
BEGIN
for x in (Select X from T)
loop
my_var:=dbms_lob.substr(x.X,32767,1)
end loop
return my_var;
I comfortably convert 32k BLOB field to string.
My problem is how to convert blob to varchar having size more than 32K.
Please help me to resolve this,
Thanx in advance for the support,
NileshNilesh,
. . . .The result of get_wkb() will not be human readable (all values are encoded into some binary format).
SELECT utl_raw.cast_to_varchar2(tbl.geometry.get_wkt()) from FeatureTable tbl;
-- resulting string:
☺AW(⌂özßHAA
Å\(÷. . . .You may also want to have a look at { dbms_lob | http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_lob.htm#i1015792 } "The DBMS_LOB package provides subprograms to operate on BLOBs, CLOBs, NCLOBs, BFILEs, and temporary LOBs."
Regards,
Noel -
How to convert a date to string
hi i have a date field in the format yyyy-MM-dd i wan to make this as string
Date lastDate = stmt.getDate(3);this will return a date 2003-11-13 i wan to make it as a stringhi all,
i found the solution thanks -
How to convert Raw data to string in Unicode conversion
Hi All,
I want to convert my report in Unicode while conversion we are getting error as "The key of internal table "IRESBD" contains components of type "X" or "XSTRING". The "READ TABLE IRESBD" statement is not permitted for such tables"
Regards,Thanks for reply ,
I tried to use the FM but not able to get any value ? is this FM converts all internal table or used to convert one field value.
My report is Unicode so i need to internal table while reading Internal table which contains fiield as GUID_16 type Raw is showing error.
Regards, -
Convert a date in String format to a Date
Hi,
How can I convert a date in String format to a Date object?
I have tried:
import java.text.*;
import java.io.*;
import java.util.Date;
import java.util.Locale;
import java.sql.*;
public class casa {
public static Connection con = null;
public static Statement s = null;
public static String sql = null;
public static String mydate = "01.01.2001";
/** Creates a new instance of casa */
public casa() {
public static void main(String[] args) throws SQLException{
try {
DateFormat shortFormat = DateFormat.getDateInstance(DateFormat.SHORT);
Date date = shortFormat.parse(mydate);
//Open Database
con = getConnection();
s = con.createStatement();
sql = "select date1 from table1 where date1 <= '"+date+"'";
ResultSet rs = s.executeQuery(sql);
while(rs.next()){
String aba = rs.getString("datum");
System.out.println("New Datum = "+aba);
} catch (Exception ex ) {
ex.printStackTrace();
closeConnection(s, con);
//Connection
private static Connection getConnection() {
Connection con = null;
String user ="aouzi";
String passe ="aouzi";
String url = "jdbc:db2:EjbTest";
try {
//Datenbanktreiber laden
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
//Verbindung herstellen
con = DriverManager.getConnection(url,user,passe);
}catch(ClassNotFoundException e){
} catch(SQLException e){}
return con;
//close Connection
private static void closeConnection(Statement s, Connection con) {
try {
s.close();
} catch (SQLException e) {}
try {
con.close();
} catch (SQLException e) {}
I'm getting the following errors:
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0180N
The syntax of the representation of a date/time of day value as character sequence is false. .SQLSTATE=22007I'm pretty sure it won't understand what date.toString() returns. If you know what format the database understands, you do it like this:
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yy"); // e.g. 18-Apr-02
String datestring = sdf.parse(date);
and use that instead of date in your sql string. Some databases understands it if you do
"to_date('18-Apr-02')"
so you could include that in your sql string as well..
You could also try to make it a java.sql.Date and hope your jdbc driver knows how to convert it to a string that the database understands if you don't know the format:
con = getConnection();
PreparedStatement ps = con.prepareStatement("select date1 from table1 where date1 <= ?");
ps.setDate(new java.sql.Date(date.getTime()));
ResultSet rs = s.executeQuery(sql); -
How to convert numeric data to binary decimal in java
How to convert numeric data to binary decimal in java Pleas egive me code example
There is no numeric data. It's all binary. If you're talking about Strings, look at the Integer class.
-
How to convert julian Date into Calendar Date
Hi,
I want convert julian Date to calendar Date (mm/dd/yyyy or mm/dd/yy format) in java.
Can any one help me how to convert julian date to calendar Date.
Thanks,
Krishore.import java.util.*;
import java.text.*;
public class jdate {
Calendar date;
public jdate(int j)
date = Calendar.getInstance();
date.set(Calendar.DAY_OF_YEAR, j);
public String toString()
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
return (formatter.format( date.getTime() ));
public static void main(String args[])
if(args.length == 1)
int j = Integer.parseInt(args[0]);
jdate julian = new jdate(j);
System.out.println("Julian date(" + j + ") = " + julian.toString());
} -
Hello.
How to convert a date field with format (dd,mm,yyyy) to format (mm,dd,yyyy)
I have text field which has a databind to a date field. When I click on it, we can select the date, it is added on the format (dd,mm,yyyy). When I want to insert this date field to a database It doesnu2019t allow me to do it because it will only accept date field on the format (mm,dd,yyyy)
I tried to store this format on a date variable and I get a message saying that is impossible to convert a string into a date.
Regards,
JoseHi Jose,
usually you format strings in c# like
string.Format("{0:yyyyMMdd}", insertyourstring);
in your case
string.Format("{0:MM/dd/yyyy}", insertyourstring);
[look here|http://idunno.org/archive/2004/14/01/122.aspx]
there are more details
if everything fails split the string with Mid()
or ask me
lg David -
How to convert from military time (string) to regular time?
How to convert from military time (string) to regular time?
First of all I need to let you know I'm very new to Crystal Reports, so I apologize and will need detailed instructions if possible.
I have created a Crystal Report pulling information from the received time field. On the report, the time is showing in military time (ex. 16:00:00).
How can I convert this time to normal time (ex. 4:00:00)
Since the field is a 'String' field and not a 'Time' field, I do not have the option of changing it under the field properties.
I hope someone can help with this.
Thank you in advance.As my fields were date only and not datetime, I ended up using the following,
If IsDate({CallLog.EmailRecdDate}) Then
CDate({CallLog.EmailRecdDate})
Else
CDate(0,0,0)
You answer lead me in the right direction.
I'm still having an issue with the 'Else' statment returning 12:00:00 because of the CDate(0,0,0), but I'm not sure what else I can use to return a blank space on the report. Any ideas?
Thanks again! -
How to convert BLOB into a String
Hi,
I got a blob column from the database.
It contains one XML File.
How to convert it into String.
I need the code for how to convert the blob into String
Thanks in Advance.A blob would be a byte-array, which you can use in the String(byte[]) constructor
-
I need convert the date of string format 'MM/dd/yyyy' to datetime format 'MM/dd/yyyy' when the system date format is 'dd/MM/yyyy'.Since
I need to search values based on date where my database datetime is 'MM/dd/yyyy' format.In my opinion you should re-consider the assumption that the date picker returns a string. Maybe it is able to return a
DateTime object directly instead of string. Then you will pass this value as a parameter of SQL query. This should work regardless of computer configuration.
Otherwise, follow the previous string-based approaches. -
How to convert system Date into DD-MMM-YYYY Format
hi friends,
please help me How to convert system Date into DD-MMM-YYYY Format.
Regards
YogeshHI..
data: w_dt(11) type c,
w_month(2),
w_mon(3).
w_month = p_date+4(2). **p_date = given date**
case w_month.
when '01'.
w_mon = 'Jan'.
when '02'.
w_mon = 'Feb'.
when '03'.
w_mon = 'Mar'.
when '04'.
w_mon = 'Apr'.
when '05'.
w_mon = 'May'.
when '06'.
w_mon = 'Jun'.
when '07'.
w_mon = 'Jul'.
when '08'.
w_mon = 'Aug'.
when '09'.
w_mon = 'Sep'.
when '10'.
w_mon = 'Oct'.
when '11'.
w_mon = 'Nov'.
when '12'.
w_mon = 'Dec'.
endcase.
Now...
concatenate p_date6(2) '-' w_mon '-' p_date0(4) into w_dt.
write w_dt. -
How to convert siebel date to following format?
Hi,
How to convert siebel date to following format?
01-01-2011 5:00 AM (dd-mm-yyyy hh:mm AM)
01-JAN-2011 5:00 AM (dd-MON-yyyy hh:mm AM)
01/01/2011 5:00 AM (dd/mm/yyyy hh:mm AM)
Please suggest functions for conversion. Have tried few but didnt work.
Thanks.Excerpts from
http://bipconsulting.blogspot.com/2010/01/my-date-doesnt-like-me-with-siebel.html
".. the date data generated by Siebel with the IO is in ‘MM/DD/YYYY HH:MI:SS’ format, so it is something like ‘10/09/2008 05:31:13’. And BI Publisher doesn’t recognize that this is a date data because it’s not presented in the ‘Canonical’ format!.."
"...There are two possible and reasonable workarounds to overcome this issue. The first one is to use one of the Siebel’s extended function ‘totext()’ to convert the Siebel date format to the ‘Canonical’ date format before the BI Publisher’s date related function comes in..."
Please read on the above link to find out how to actually resolve this issue.
Good Luck
(please if this provides a solution for you grant the points and close this thread. Thanks!)
Jorge -
How to convert CLOB data (now it is in html format) to Normal text format
Hi,
Can anybody let me know the solution for how to convert CLOB data into normal Text.In my case the table column having CLOB datatype and the data is in html format.when i run the report the column is displaying html tags .Now i need to convert that html tags into normal text.
Pl. let me know if any one know the solution.
Regards,
Thulasi.KLONG has been depricated since 8i so I don't believe there is a general solution to go backwards short of reloading the data.
Justin -
How to convert mongodb data to oracle
The requirement is I need to convert the mongodb or JSON data which is provided to us in Oracle format
so that it can be used in Oracle Data Integrator ODI
Edited by: 918554 on Aug 9, 2012 10:37 PM
Edited by: 918554 on Aug 9, 2012 11:02 PM
Kindly reply soon its urgent
Edited by: 918554 on Aug 9, 2012 11:03 PM918554 wrote:
how to convert mongodb data to oracleThis is NOT an Oracle problem or solution.
http://www.mongodb.org/display/DOCS/SQL+to+Mongo+Mapping+Chart
Maybe you are looking for
-
QM_Follow up action in usage decision
Dear QM Experts, 1. We can record the defects in inspection lot (01 origin) which creates quality notification in background under F2 type. 2. If the defects are recorded usage decision is given as Rejected. Requirement is auto email should b
-
TDS at lower rates for certian limit
Hi experts, Income Tax Department gives vendors certifcate for lower deduction of tax u/s 197, which is a permission to a payer to deduct NIL Tax or tax at a lower rate. This permission is generally given for a Financical Year. However, recently it i
-
Error time out to connect FTP server
Hi Experts, I am getting the error in receiver communication channel (FTP) as : An error occurred while connecting to the FTP server ''. The FTP server returned the following error message: 'com.sap.aii.adapter.file.ftp.FTPEx: The control connection
-
After update ios. iPhone asks me to write the password and id which i dont know
hello! I have a problem with my iphone 5 ,after update ios.Iphone asks me to write the password and id which i dont know because all settings set in Egypt when i bought IPHONE.Is it possible to change id or make smth with this problem? I bought the
-
Connecting Counter hardware to DAQCard-AI​-16E-4
I am dealing with a pulse train signal produced by our hardware with varying period, and am looking to obtain the time between each lo-hi transition. I have looked at the Count Time - Easy (DAQ-STC).vi within Labview 6 and this seems to give me what