Converting a Java style date into useful format
If I am calling a web service that returns a Java style date as a numeric value, such as 1177651563767 (milliseconds since 1 Jan 1970), how can I display this as a human readable date (hh:mm:ss dd-mm-yyyy? I have looked at the <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/40/a228173435437394f54c56de571ca4/frameset.htm">SAP help pages on date functions</a> and the
<a href="https://wiki.sdn.sap.com/wiki/display/VC/DateandTime+Formats">wiki page on date and time formats</a>, but neither seems to help.
My Java date is a numeric.
Thanks
Hi Michael,
you can call the webservice with another webservice or an RFC and then use Java or ABAP to convert the value into the right format. My opinion is as you mentioned that there is no way with VC. Maybe you can use a time function (DADD as it is described <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/40/a228173435437394f54c56de571ca4/frameset.htm">here</a> and sum up to 01/01/1970 your [value in seconds]/60 this should work, but I never tested it.
Maybe this works, but this isn't a good solution anyway.
Best Regards,
Marcel
Similar Messages
-
How to convert the alv list data into pdf format
Hi Expersts,
Is it possible to convert the alv list output data into PDF format? if yes, then please help me with this issue.
thanks in advance,
Regards,
Samadhii samad,
you can go through these link.i hope it ll solve your purpose
How to convert list output to PDF
Display ALV list output in PDF format
regards,
Shweta -
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 -
Converting a result of query into XML format
Hi,
I am going to use DBXML,DBBOM and DBXSL
ie PLSXML utilities to convert the records returned after querying the data into XML format.Is it possible to do this using these packages?
Should i use Oracle SQL XML Utility?
Which would be better?I've used both utilities and I personally like the concept of SQL Utility. I'm still
having some problem with encoding issues
but it seems a better tool to use with Java.
If I'm just going to be using PL/SQL, I'll
use PLSXML utilities. Note that PLSXML does
not support SAX nor will XSQL servlet work
with it.
null -
How to download the Dynamic data into PPT format
Hi Friends,
I have one doubt on WDJ. How to download the Dynamic data into PPT format. For Example Some Dynamic data is available in to View in that One Download Link or button available. Click on Download link or button download that data into PPT Format
Is it possible for WDJ. If possible please tell me.
Or
How to create Business Graphics in Web Dynpro Applications depening up on Excel Data and finally we can download the Business Graphics into powerpoint presentation.
Thank you,
Regards
Vijay Kalluri
Edited by: KalluriVijay on Mar 11, 2011 6:34 AMHi Govindu,
1. I have one doubt on WDJ. Click on either Submit Buttion or LinkToURL UI we can download the file that file having ppt formate(Text.PPT).
I am using NWDS Version: 7.0.09 and Java Version: JDK 1.6
2. is it possible to download the business Graphics in to the PPT by using Java DynPro
Regards
VijayK -
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); -
Is there a way to download data into CSV format?
Is there a way to download data into CSV format?
I can't do this using delimiter as ',' because user wants the decimal format in the ','s only.
Any suggestions?go through this link...
Download CSV file in presentation server through FM GUI_DOWNLOAD
Re: how to create a CSV file
type-pools:TRUXS.
data: begin of itab occurs 0,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
end of itab.
data: itab1 type TRUXS_T_TEXT_DATA.
select vbeln
posnr
up to 10 rows
from vbap
into table itab.
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = ','
TABLES
I_TAB_SAP_DATA = itab
CHANGING
I_TAB_CONVERTED_DATA = itab1
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:TEMPtest.TXT'
TABLES
data_tab = itab1
EXCEPTIONS
OTHERS = 1. -
Put java.sql.Date in correct format
I need to put java.sql.Date in correct format to query an Oracle database.
Here is my code:
SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yy");
java.util.Date dateChosen = jXDatePicker1.getDate();
String strDate = formatter.format(dateChosen);
System.out.println("Date Chosen: " + strDate); // output is: 11-Feb-00
java.util.Date parserDate = null;
try {
parserDate = formatter.parse(strDate);
} catch (ParseException re) {
System.err.println("Exception caught: " + re.getMessage());
// create java.sql.Date object
java.sql.Date oraDate = new java.sql.Date(parserDate.getTime());
System.out.println(oraDate); // date is in this format: 2000-02-11
System.out.println("formatted oraDate: " + formatter.format( oraDate ) ); // no good, stringIf I use formatter.format( oraDate ) I get the correct format (11-Feb-00) BUT it is no longer a sql Date, it is a String which can't be use.
I have looked at the API and many other forum threads on this, any help would be greatly appreciated!In the class with the PreparedStatement, I pass the date like this:
public class report extends javax.swing.JDialog {
java.sql.Date newDate;
public report(java.sql.Date passedOraDate, String passedtxtDate) {
super();
initComponents();
setTitle("Report");
setModal(true);
newDate = passedOraDate;
statusLabel.setText(passedtxtDate);
System.out.println("passedtxtDate: " +passedtxtDate);
System.out.println("newDate: " +newDate);
}Here is the code that uses the actual PreparedStatement:
try {
// In my actual code I have all columns listed in query
String query = "SELECT * FROM report WHERE repdate = ?";
ps = conn.prepareStatement(query); // create a statement
ps.setDate(1, newDate); // set input parameter
rs = ps.executeQuery();
// extract data from the ResultSet
ResultSetMetaData md = rs.getMetaData();
int columns = md.getColumnCount();This is greatly edited to show relevant code! -
Download data into .csv format ( ABAP webDynpro )
Hi gurus ,
I am new to WebDynpro .
My requirement is that i need to download all my datas into csv format . But when i am using the function module
GUI_DOWNLOAD , an error is coming " Couldnot ascertain code page "
I have used the F.M ' SAP_CONVERT_TO_CSV_FORMAT '
call function 'SAP_CONVERT_TO_CSV_FORMAT'
exporting
i_field_seperator = ';'
I_LINE_HEADER =
I_FILENAME = ''
I_APPL_KEEP = ' '
tables
i_tab_sap_data = it_fail
changing
i_tab_converted_data = csv_converted_table
exceptions
conversion_failed = 1
others = 2
when i am using GUI_DOWNLOAD i am getting the above error
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\test.csv'
tables
data_tab = csv_converted_table.
ENDIF.
suggest me or provide some sample code to download the the csv_converted_table that i got from the F.M
'SAP_CONVERT_TO_CSV_FORMAT' into .csv format to my local drive .
Thanx Gurus .Heyy Thanks for proving a new concept ..
actually i was using the following code .
DATA : lv_filename TYPE rlgrap-filename,
lv_timestamp(55) TYPE c,
lt_csv TYPE truxs_t_text_data,
ls_csv TYPE LINE OF truxs_t_text_data,
p_path TYPE string VALUE 'D:\Result'.
Constants : lc_ex TYPE char4 VALUE '.csv'.
CONCATENATE p_path lc_ex INTO lv_timestamp.
lv_filename = lv_timestamp.
CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
EXPORTING
i_field_seperator = ','
i_filename = lv_filename
TABLES
i_tab_sap_data = it_fail
CHANGING
i_tab_converted_data = lt_csv
**-------Place the file in the required directory.
OPEN DATASET lv_filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT lt_csv INTO ls_csv.
TRANSFER ls_csv TO lv_filename.
ENDLOOP.
But i m getting the following error
File "D:\Result.csv" is not open.
Can u please tell me what needs to be done ...??
Thanks -
How to convert internal table data into excel format?
Hi all,
I want to convert internal table data in excel format and then
send it as email attachment in workflow.
Please tell me how do i perform this.
Regards,
Arpita.Hi Arpita,
Try this sample code::
Send mail
maildata-obj_name = 'TEST'.
maildata-obj_descr = 'Test Subject'.
loop at htmllines.
mailtxt = htmllines.
append mailtxt.
endloop.
mailrec-receiver = 'your receiver mail id'.
mailrec-rec_type = 'U'.
append mailrec.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'EXL'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
exceptions
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8.
if sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Hope it will help you.
Regards,
NIkita -
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 -
JTextfield input Date convert to java.sql.Date
Hi. I have a textfield for users to input date in 'dd/mm/yyyy' format and I would like to format this input into java.sql.Date to be stored into a database. How should I go about doing that ?
I did the following:
SimpleDateFormat formatDate = new SimpleDateFormat("dd/mm/yyyy");
java.util.Date invoiceDate = formatDate.parse(jTextField3.getText());
java.sql.Date sqlDate = new java.sql.Date(invoiceDate.getTime());and when I input into jTextField3 the value '28/05/2008' , I found in my database '2008-01-28'. January and May is a few months off and is totally not what I wanted.Hi you did you code perfect, but you need to change the pattern for formatting the Date
dd - date
mm - minute
yyyy - year
here you are parsing month as minute, so the output may wrong..!
If you need to format properly
please use the below pattern
{color:#0000ff}SimpleDateFormat formatDate = new SimpleDateFormat("dd/MM/yyyy");{color} -
How to download dynamic table data into CSV format
Hi,
I have data in dynamic table <it_data>, and I want to download that into CSV format.
so I tried to use FM SAP_CONVERT_TO_CSV_FORMAT but how to use this FM with dynamic table?
here <it_data> type standard table, we can pass this to I_TAB_SAP_DATA. but problem is with changing parameter. (TRUXS_T_TEXT_DATA), what type of table it should be?
and one more thing is <it_data> structure is also dynamic , depending on input the structure of <it_data> may vary.
Regards,
MrunalHi,
check this one may be help full to u...........
*Use FM SAP_CONVERT_TO_CSV_FORMAT and pass a Delimiter and ITAB. This
returns an Ouput_String
Convert Internal Table to ; delimited format
There is a filename parameter on this FM but I don't think it's used
call function 'SAP_CONVERT_TO_CSV_FORMAT'
exporting
i_field_seperator = Delimiter "default ';'
i_filename = Filename
tables
i_tab_sap_data = ITAB
changing
i_tab_converted_data = Ouput_String
exceptions
conversion_failed = 1
others = 2.
Regard's
SHAIK. -
Is BPEL supports writing character data into binary format ?
Hello,
I can write a BLOB data from DB to a file using Opaque feature in File Adapter.
But is it possible to write Character data into Binary or Hex Format either by using base64Binary or Hex or bytes formats supported in XML?
ThanksI am looking WHOLE FORMA DATA in either XSTRING or BINARY FORMAT or any other format, except STRING format.
I gave COUNTRY as an example, but am looking the HWOLE form AS IS
Any help pls.
Thank you -
Isuue: Exporting Data into xls format
Hi,
I've connected to DB via Jdeveloper!!
I tried using "export" function from Oracle DB Table,
Its exporting only sql scripts, I would like to know is there way to export the data(metadata) from DB tables into xls format.
Thanks!!!!I tried using "export" function from Oracle DB Table,
Its exporting only sql scripts, I would like to know is there way to export the data(metadata) from DB tables into xls format.
Wrong forum! You need to post the question in a JDeveloper forum.
https://community.oracle.com/community/developer/english/development_tools/application_development_in_java/jdeveloper_and_adf
If you use the free Oracle sql developer (based on JDeveloper) you could just write a simple query to get data in CSV (not xls) format:
SELECT /*csv*/ * from myTable
See this article by Jeff Smith
http://www.thatjeffsmith.com/archive/2012/05/formatting-query-results-to-csv-in-oracle-sql-developer/
Maybe you are looking for
-
Restoring movies from Time Machine backup
Last night I tried restoring my photos from a Time Machine backup. It appears that all my movies (.avi files) have been restored as .jpg files. When I open the pictures folder, it automatically opens iPhoto and starts importing my pictures. Is there
-
Apple mobile device failed to start during installing itunes
I got an error message while trying to install iTunes says that apple mobile device failed to start. i ignored this message and continued the installation process but it gave me another error and iTunes didn't work. i uninstalled it many times and tr
-
Hi i recently bought an ipad 1st gen from a friend i was playing it for awhie and decided to transfer my stuff onto it so i plugged into itunes did the update then it closed out and now my computer wont even reconize it and my ipad says to plug it in
-
Hi Friends!!!!!, How we can add our Portfolios in the Adobe Future Artists list.If you know anybody, Please tell me what is the process. Thanks Alot...... Hanumanth
-
AHP/Dinesh, Is there any reason for mismatch in number of records in setup tables to sap tables. In sap table there are 150k records, when i filled the setup tables and checked in rsa3 with 10000 records and 20 extraction calls it gives me a max. of