Conversion of Date value to Timestamp
I have a value like "00000000000000" in Date format. Now I want to convert it in timestamp. How can I do it? Please help me.
I am using mysql-3.23.51-win and j2sdk-1_4_0_01-windows-i586.
Thanks
Amit Pandya
Hi jschell,
please find more details,
Please find some more information from my side
1) I am passing Timestamp Object
2) I am using PreparedStatement
3) code
Table : client
create table client (
MODIFIED timestamp(14)
);Bean Class
public class GenericClient {
private java.util.Date _modified;
public java.util.Date getModified() {
return _modified;
public void setModified(java.util.Date newVal) {
this._modified = newVal;
}Method - which is fired error
private Client decodeRow(ResultSet rs) throws SQLException {
GenericClient obj = new GenericClient();
*obj.setModified(rs.getTimestamp(1));*
return obj;
}3) Error Stack
==========
java.sql.SQLException: Cannot convert value '00000000000000' from column 1 to TIMESTAMP.
at com.mysql.jdbc.ResultSet.getTimestampFromString(ResultSet.java:5538)
at com.mysql.jdbc.ResultSet.getTimestampInternal(ResultSet.java:5566)
at com.mysql.jdbc.ResultSet.getTimestamp(ResultSet.java:5219)
at com.ksea.manager.ClientManager.decodeRow(ClientManager.java:463)
at com.ksea.manager.ClientManager.loadByWhere(ClientManager.java:266)
at com.ksea.manager.ClientManager.loadByWhere(ClientManager.java:221)
at com.ksea.manager.ClientManager.loadByWhere(ClientManager.java:203)
at com.ksea.manager.ClientManager.loadByUsername(ClientManager.java:53)
at com.ksea.nt.DBSynch.synchEmployees(DBSynch.java:83)
at com.ksea.nt.DBSynch.synchAll(DBSynch.java:35)
at com.ksea.nt.DBSynch.main(DBSynch.java:168)4) db Info
=======
I am using mysql-3.23.51-win and j2sdk-1_4_0_01-windows-i586.
Edited by: aMiT on Dec 19, 2007 1:55 PM
Similar Messages
-
Conversion from DATE to TIMESTAMP datatype
Hello,
My issue is as follows:
1. I have one variable of type DATE, which I assign the value of SYSDATE
mydatevar DATE:= SYSDATE;2. I want to find *"today"*, truncated to DAY
TRUNC (mydatevar, 'DD')
TRUNC function returns DATE datatype. So I will receive in point 2 for example *'2010-01-13 00:00:00'*.
3. I want to assign the value from point 2 to a variable of type TIMESTAMP
mytimestampvar TIMESTAMP := mydatevar;which implicitly will convert the DATE variable to TIMESTAMP.
Problem: During the conversion (both implicit and explicit conversion with a format mask) I lose the "00" hours and "00" minutes and receive something like this: "10-JAN-13 *12*.00.00.000000000 AM".
Question: How can I convert from DATE to TIMESTAMP keeping hours and minutes zeros?
Why I need this conversion: I have a table with a column "column1" TIMESTAMP(0) and I would like to take only those rows from the table, where "column1" is in range from today 12 o'clock in the morning till now (whatever hour it is).
NLS characteristics of the database:
PARAMETER VALUE
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CHARACTERSET AL32UTF8
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_RDBMS_VERSION 10.2.0.4.0Session parameters are the same.
DBTIMEZONE is "+02:00".Verdi wrote:
Problem: During the conversion (both implicit and explicit conversion with a format mask) I lose the "00" hours and "00" minutes and receive something like this: "10-JAN-13 *12*.00.00.000000000 AM".I don't think you are necessarily losing any information whatsoever. It's probably more of a function of your NLS_TIMESTAMP_FORMAT and NLS_DATE_FORMAT. For example your NLS_DATE_FORMAT could be setup by default for a HH24 (24 hour time) which would report midnight as "00" hours. However, it looks like your NLS_TIMESTAMP_FORMAT is setup with a "HH" format with a meridian indicator which means 12 hours time.
Your comparisons should be using date/timestamp data types anyways so as long as the input value is converted properly into a date type this shouldn't matter anyways.
You can see what is actually stored by using the DUMP function:
SQL> SELECT DUMP(TO_TIMESTAMP(TO_CHAR(TRUNC(SYSDATE,'DD'),'MM/DD/YYYY HH:MI:SS AM'))) AS TSTAMP
2 , DUMP(TRUNC(SYSDATE,'DD')) AS DT
3 FROM DUAL
4 /
TSTAMP DT
Typ=187 Len=20: 218,7,1,13,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0 Typ=13 Len=8: 218,7,1,13,0,0,0,0As you can see the TSTAMP and DT store nearly the same values (218,7,1,13), but the TSTAMP has more precision because of fractional seconds.
HTH!
Edited by: Centinul on Jan 13, 2010 7:23 AM -
Disallowed implicit conversion from data type datetime to data type timestamp
Received error: [Macromedia][SQLServer JDBC
Driver][SQLServer]Disallowed implicit conversion from data type
datetime to data type timestamp, table 'myTbl', column 'duration'.
Use the CONVERT function to run this query.
I have a field named duration hh:mm:ss.lll that I am trying
to insert into MS SQL. DB has field defined as [duration]
[timestamp] NOT NULL,
My insert has this: INSERT INTO myTbl( duration) VALUES(
<cfqueryparam value="2006-05-26 11:12:13"
cfsqltype="CF_SQL_TIMESTAMP"/> )
Why does this not work? rrrrrrrrrrrrrr! BTW: also tried with
seconds as 13.111 which did not work. Does the db duration need to
be date? I just want to store a duration for the time of a movie...
10 Qquote:
Originally posted by:
quiet1
Received error: [Macromedia][SQLServer JDBC
Driver][SQLServer]Disallowed implicit conversion from data type
datetime to data type timestamp, table 'myTbl', column 'duration'.
Use the CONVERT function to run this query.
I have a field named duration hh:mm:ss.lll that I am trying
to insert into MS SQL. DB has field defined as [duration]
[timestamp] NOT NULL,
My insert has this: INSERT INTO myTbl( duration) VALUES(
<cfqueryparam value="2006-05-26 11:12:13"
cfsqltype="CF_SQL_TIMESTAMP"/> )
Why does this not work? rrrrrrrrrrrrrr! BTW: also tried with
seconds as 13.111 which did not work. Does the db duration need to
be date? I just want to store a duration for the time of a movie...
10 Q
Duration as a timestamp? How odd, most people would store it
as an integer. Or, if you want to build your own string, the syntax
is {ts 'yyyy-mm-dd hh:mm:ss'}. The seconds might not be required.
In any event, use createodbcdatetime() for the value you want
to put into your table. -
How to trim timestamp from a Date value
Hi,
Iam retrieving Date values from database(mysql). When i display these dates in a jsp ,those r displaying like this
2007-01-01 00:00:00.0
Actually we dont want that timestamp at the end of the date.
How can i trim that time stamp from date value.
We r using Hibernate to interact with database.
pls give some suggestions regarding this
thanksHi,
Iam retrieving Date values from database(mysql).
When i display these dates in a jsp ,those r
displaying like this
2007-01-01 00:00:00.0
Actually we dont want that timestamp at the end
of the date.
How can i trim that time stamp from date value.
We r using Hibernate to interact with database.
pls give some suggestions regarding this
thanksBy display, I assume you mean something like:
System.out.println(myDate)
or
System.out.println(myDate.toString()); // which is the same thingUse SimpleDateFormat class to format the date anyway you like. -
Performance - Conversion of characteristic values to SID
Greetings:
Yesterday I load 556.000 record into an infocube.
No transformations of any kind. Direct assign for every infoobject. Very simple
It lasted 1 h 30m to complete the loading.
It started loading 7 datapackage of 50.000 records each.
I realized that 3 of those datapackage (#2, #4 and #7) lasted from 41:47min to 41:59min in the "Conversion of characteristic values to SID" task. The other 5 lasted ... seconds.
Any idea of that could be going on during this conversion?
I don't understant why some datapackages last so long and other don't.
Does anybody has any idea about this?
Thanks in regards.
GuillermoHi Daniel,
The SID generation is based upon the Dimension Table and Master data.
If you see the dimension table can be build with different types like:
one to many
many to one
many to many
one to one
So, if the dimension's for that datapacket data is many to many then it has to get all the relations and then it has to assign an SID.
If it is one to one then there will be no more work to be done by the system to assign the SID's
Hope you understood the back-end process.
With Regards,
Ravi Kanth. -
Slow dataload into Infocube- Conversion of Characteristic values to SIDs
Hi All,
we are facing a slow delta load issue when loading from a DSO into an InfoCube ( approx 150,000 recs).
After checking the monitor found that
- The Conversion of Characteristic values to SIDs is taking time
- The Start Routine time is real quick ( in secs)
The underlying DSO is hugh and there is no SIDs Generation upon Activation flag set for it
Master data is loaded first and than we are loading the transaction data.
i've tried refreshing the stats of the Cube, Reduce the size of the data package,
Deletion of Indexes than Loading and recreation of Indexes, no joy at all.
Any comments and recommendations are much appreciated.
Thanks,
NatalieHi Natalie,
The problem for your slow delta load from DSO to cube is because the SIDs Generation upon Activation flag is unchecked at DSO level .
Becasue of which your activation is faster but your loading from DSO to cube will be slower as you only mentioned that SIDs are being generated .
One recommendation will be to switch on the property of the DSO SIDs Generation upon Activation flag .
Are there any secondary indexes also in DSO ?
You can try deleting them also during loading the data from DSO to cube .
I guess your change log table is also huge in this case . If possible we can think of deleting the log table also . Then for the new records let it get filled .
Hope the above reply was helpful.
Regards,
Ashutosh Singh .
Edited by: DEADLOCKS on Apr 21, 2011 5:08 PM -
Conversion of Characteristic Values to SIDs. Load Very slow
Hi Experts,
We have a slow load issue when loading from a Write-Optimized DSO into an InfoCube. 8 millon recs in 10 hours.
We check the start, end, and rules routines and every is ok but for all the package the load was very slow in the Conversion of Characteristic Values to SIDs.
Can any help me with this?
Thanks a lot,
AlejandroHi,
It is because the SIDs Generation upon Activation flag is unchecked at DSO level .
One recommendation will be to switch on the property of the DSO SIDs Generation upon Activation flag .
Are there any secondary indexes also in DSO ?
You can try deleting them also during loading the data from DSO to cube .
Also load your master data first and activate it before loading it to cube.
Thanks, -
Get millisecond values from timestamp column in v$logmnr_contents
Hello
How do we get millisecond values from timestamp column in v$logmnr_contents.
I tried with following query.
select scn,To_Char(timestamp,'DD-MON-YYYY HH24:MI:SS:FF') from v$logmnr_contents WHERE OPERATION NOT IN('START') and username ='SCOTT' and sql_redo is not null and (seg_owner is null or seg_owner not in('SYS'));
it says ORA-01821: date format not recognized. I want to find the relation of scn with timestamp. In forums i found, scn is derived from timestamp value. I dont know its correct or not.
if i query with out FF in time format i get like
scn timestamp
808743 27-NOV-2007 00:12:53
808743 27-NOV-2007 00:12:53
808743 27-NOV-2007 00:12:53
808744 27-NOV-2007 00:12:53
808744 27-NOV-2007 00:12:53
808744 27-NOV-2007 00:12:53
if scn is derived from timestamp with milliseconds, each scn should be different right?More help pleaseMay be there's an easy way solving your problem, I did it like that:
CREATE TABLE quota_test (test VARCHAR2(50))
INSERT INTO quota_test
VALUES ('update "SCOTT"."NEWTAB1" set a="34" and b="45"')
SELECT test normal, REPLACE(SUBSTR(test,INSTR(test,'"',1),INSTR(test,'.',1)+2),'"','') changed
FROM quota_test
Result is :
NORMAL
update "SCOTT"."NEWTAB1" set a="34" and b="45"
CHANGED
SCOTT.NEWTAB1
If you didn't understand, I can explain what I wrote -
How to pass date value to an UDF
Hi,
I am working in SDK UI. I have created a form. In this form there is a edit text box. I have to pass a date value to that object. I have taken a variable and pass a date value in "yyyy/mm/dd" format. When I am assign this variable to the object to pass the date value to that object then I am getting an error. The error is "Unable to cast object of type 'system.string' to 'system.IFormatProvider' ".
I have written the code like this :------>
Dim AtenDate As String
AtenDate = '2007/08/01' ' format "yyyy/mm/dd"
Dim txtEditDt As SAPbouiCOM.EditText
oItem = oForm.Items.Item("11")
txtEditDt = oItem.Specific
txtEditDt.String = AtenDate.ToString("dd/MM/yyyy")
After the last line the error is getting fire.
Please help me how I can pass the date value to that object.
Please help me. It is very urgent.Date and Double conversion is really a confusing thing in B1-SDK programming in the beginning.
But once you got it it's okay.
When working with date-time and doubles (System and SBO-Price/SBO-Quantity), you should always take care about the language of...
...system (windows)
...SBO User Interface
These two formats could make trouble when the programming has been made only for a specific configuration of these two.
The third format for SDK-Programming is
...the SBO-DB-Format, which is language-independent and always a String
Here are some rules:
<b>EditText.String</b> ALWAYS returns the value you see on the SBO GUI. It depends on the SBO Date, Price etc.-Format the USER has configured in the Administration. Consider that the user has (for example) the possibility to choose a "#" (or whatever) as decimal-seperator. Direct (implicit) conversion of such a string to a double will fail at the latest now.
The savest way to get a .NET-Double or DateTime- Value from EditText.String are the conversion methods of SBOBobs-Object (see SDK-help -> BoBridge, Format_MoneyToString...etc.).
I think it's a good idea to write some wrapper functions for that methods, cause they always need a recordset which blows up the code too much.
<b>EditText.Value</b> always (system/sbo-language independent) returns the value as a String in DB-Format (Double as "12345.126700" and date as "20070930".
For that you must asure that the EditText is bounded to a format-corresponding datasource. Price, Quantitiy.... if you need a double.
If your "price"-field would be bound to ShortText and the user wants (assuming the example from above) a "#" for decimal-point, then a GUI-seen value like "12,421#12" is also returned as "12,421#12" by EditText.Value. But If bound to Price-DataSource it's "12421.120000"
=> So always do a DataBind to the Data - Type which is needed is recommended for this to work!
In my case EditText.String and -Value is mostly (only...? needed for B1-System-Forms where using of DataSources is restricted.
The prefered way of read/write values is the
<b>UserDataSource.ValueEx and DBDataSource.GetValue/SetValue</b>-method. It's also always in DB-Format as EditText.Value before, but gives much more performance.
Once you got some conversion-functions for "DB-Format-String" to ".NET-DataType" and vice verca (I've defined some .NET - System.Globalization.XXXFormatInfo-Objects for that) all of your problems are things of the past
Regards,
Roland
null
Message was edited by:
Roland Toschek
Edited by: Roland Toschek on Jan 22, 2008 5:32 PM
Trying to clarify a sentence -
Creating a view on two ODS using the most actual value of Timestamp
Hi All,
I am creating a view on two ODS. I have made an internal join of the field timestamp from both the tables. But the timestamp in bot ODS do not match, which is why there is no data visible in the view.
There is a requirement that the value of timestamp to be used has to be the most actual value of timestamp from the two ODS.
I would be grateful if some pointers regarding the same could be provided.
Thanks and regards,
Shruti KulkarniHi Shruti,
ODS should not be linked on Timestamp basis, there must be some other alternatives like document number, date etc etc...
In other case if its possible to include addtional key figure in to ODS then
create a dummy key figure , in the aggregation tab page Select Exception aggregate as "Last Value" and in the "agg.ref char" Select time stamp as info object. This setting will make sure that in the ODS you have only last updated data.
Hope that helps.
Regards
Mr Kapadia
Assigning points is the way to say thanks in SDN. -
How to enter a date value in a Temporary Table
Hi!
Could anyone explain to me how I can enter a date value (say 26 October 2011) in a Temporary Table?
I tried the simple example below, but it gives the foll. error message:
Conversion failed when converting date and/or time from character string
CREATE TABLE Temp1
Column_A date,
Column_B varchar(max)
Insert into Temp1
values ('26.10.2011', 'bbb')
Thanks
Leon LaiHi,
Try This.....
CREATE TABLE Temp1
Column_A datetime,
Column_B varchar(max)
Insert into Temp1
values ('10/26/2011', 'bbb')
Thanks
Shafi -
ABAP API to store DATE value in MDM 5.5
Hello All,
Currently I am working on MDM 5.5 and need to have some suggestions on ABAP API Function module to store date values in MDM.
We have interface from where we take the user input which updates the field value back in the MDM.
On the basis of similar scenario we have "DATE" field on the interface which will update the date and time in MDM, also we are making use of ABAP API for development.
The problem is that data type mismatch is happening between MDM and ABAP API,please let me know which ABAP API Function module should we use which simply accepts the DATE and TIME for every single record.
Source code provided will be much more appreciable.
Regards,
SwapnilHi Swapnil.
In the same link provided by Sudhanshu, can you navigate to the node "Retrieving Complex Types".
It has sample codes and MDM interfaces for TimeStamp, Time Stamp, User Stamp, Literal Date, Literal Time etc.
As suggested, you can also try to use the type MDM_CDT_DATE_TIME.
See the sample code provided in the link as below:
Type: MDM Literal date:
CLEAR lv_date.
CONVERT TIME STAMP ls_result_ddic_ex-fieldliteraldate-content TIME ZONE sy-zonlo INTO DATE lv_date.
WRITE: AT (10) lv_date, '|'.
Type: MDM Literal time:
CLEAR lv_time.
CONVERT TIME STAMP ls_result_ddic_ex-fieldliteraltime-content TIME ZONE sy-zonlo INTO TIME lv_time.
WRITE: AT (10) lv_time, '|'.
Regards
Bala -
Check on Master Data Value (User Manual Input)
Hi all,
i have the following situation:
User has to insert a set of Characteristic Value (these are not limited in level for any value nor variable) to be able to enter layout and does manual planning, with my great astonishment i have noticed that BPS does not do any check on the master data value inserted by the user, for example if user insert value '1' for 0payscalety CH instead of '01' the system does not give any error message and goes directly to perforate the Master Data with this wrong value.
Does exist any setting/tip to avoid this unpleasant situation?
Many thanks in advance
FabioHello Fabio,
personal I would not set up a data model, which makes differences between 01 and 1. It is known that this will make always problems in the future.
I believe it is quite more unpleasant that SAP does not provide detailed documentation...
You can use e. g.
- conversion routine in BW char.
- message, fox
- char. rel. and / or ABAP
- drop down list which does not allow manual input
to manipulate before / after input. These are some of those possibilities, which SAP provides.
regards
Eckhard
Message was edited by: Eckhard Lewin
Message was edited by: Eckhard Lewin
Message was edited by: Eckhard Lewin -
Hi,
I have the following urgent problem.
I created a pageflow which uses a form bean (created with a db control) to insert
values in a table. I overcame the disability to insert date values in the table
by converting this columns to string values in the table. But now I have to insert
a sysdate in a column that holds the row sampled date. How is it possible? I used
javascript without an success.
Code in jsp:
document[getNetuiTagName("myForm",this)][getNetuiTagName("date",this)].value=new
Date();(have used string values too)
<netui:hidden dataSource="{actionForm.sampled}" tagId="date"/>
Code in .jcx file
<xsd:element name="SAMPLED" type="xsd:dateTime" wld:JDBCType="DATE" minOccurs="0"
wld:TableName="theTable" nillable="true">
* </xsd:element>
Code in .jpf file
* <pageflow-object id="formbeanprop:portlets.Career.Submit_CV.Submit_CVController.DatabaseForm#sampled#java.sql.Timestamp"/>
public static class DatabaseForm extends RowSetForm
public java.sql.Timestamp getSampled()
return sampled;
public void setSampled(java.sql.Timestamp newOne)
registerChange("sampled");
this.sampled = newOne;
I have tried to use java.sql.Date too...
Any help would be very appreciated.
Thx,
VincentHi,
Hope You're using the template.fmb.
If your Custom Form is in INV module, use 'FND_ORG.CHOOSE_ORG;' in the pre-form.
Else Set the org id dynamically,
begin
MO_GLOBAL.SET_POLICY_CONTEXT(ACCESS_MODE,ORG_ID);
end;
Example:
begin
MO_GLOBAL.SET_POLICY_CONTEXT('S',101);
end;
S - Denotes that the current session will work for Single Org_id (101)
M - Denotes that the current session will work for Multiple Org_id
Thanks -
Logic to compare date with standard timestamp
Hi Experts,
I want to retrieve the data which is "n" moths old.
To compare that I want use only SYSDATE without timestamp.
I want to use standard timestamp '23:59:59' along with SYSDATE.
The condition should be as below.
UPDATE_DATE <= ADD_MONTHS(15/01/2013 23:59:59,-3)
UPDATE_DATE <= ADD_MOTHS(30/01/2013 23:59:59,-4)
UPDATE_DATE<=ADD_MONTHS(sysdate||' '||'23:59:59',-3);Please help me how to implement it.
Thanks in advance.973205 wrote:
Thanks for your reply.
Your query is not meeting my requirement.
It just adding one day after it's adding months.
TRUNC(sysdate) means it will truncate timestamp.
I want to use standard timestamp along with sysdate.
TRUNC(sysdate)||' '||'23:59:59' after that I want to add months.
What you are trying to do is to concatenate a character string to a DATE value - which will not work and is not logical also..
This can be achieved as below - minus 1 second from trunc(sysdate+1)
select trunc(sysdate+1)-(1/(24*60*60)) dt
from dual;
DT
03-Feb-2013 23:59:59 Your requirement is to filter as UPDATE_DATE<=ADD_MONTHS(sysdate||' '||'23:59:59',-3);
This can be done as
UPDATE_DATE<=ADD_MONTHS(trunc(sysdate+1)-(1/(24*60*60)),-3);The same thing can be achieved by replacing "<=" with "<" as
UPDATE_DATE<ADD_MONTHS(trunc(sysdate+1),-3);Edited by: jeneesh on Feb 3, 2013 12:39 PM
Maybe you are looking for
-
Can I boot up a Tiger Disk IMage HDD using my Macbook Pro (with Leopard)
Before my Ibook G4 crashed (tiger 10.4) I made a disk image using super duper. I purchased a Macbook Pro (leopard) and when I tried booting the disk Image I had made using superduper on a smart disk firewire drive, it would not recognize it. I held t
-
IPhone events don't sync to iCal
Problem Summary: Events created on my iPhone do not sync over to my iCal on my computer. Tech Specs: * iPhone 4S, running iOS 6.1.3 * MacBook Pro, running OS X 10.6.8 * Sync via cable directly onto mac (not wifi, not iCloud) Potentially Useful Observ
-
Append error message to itab and download to excel
Hi GURUS, Need urgent help I have an internal table ( say columns a,b,c) I need to validate the fields and upload to ztable. If any of the row fails during validation. I need to write a corresponding message and append it to the contents of itab--ou
-
How do I print an address label, & what size paper etc.? Message was edited by: Johanne Christmas
-
I am trying to setup my iPad for FaceTime. I go to Settings-FaceTime. Put my Apple ID and password. Asks to put the password again. Then asks if I want to use my email I'd for FaceTime. Click Yes. Tries to verify the applied and gives the error menti