To get yr as YYYY format
Hi
i have the table mtl_material_transactions
of which the column transaction_date has the following values
1/1/2007
1/1/2007 1:01:50 PM
2/11/2011 3:39:38 PM
i want to get another column Mon and YR
Mon YR
JAN 2007
FEB 2011 ETC
i tried
SELECT
TO_CHAR(TRANSACTION_DATE )col1,SUBSTR(TO_CHAR(TRANSACTION_DATE ),4,3)MON,
transaction_date FROM MTL_MATERIAL_TRANSACTIONS
i get the output as
col1 MON transaction_date
1-JAN-07 JAN 1/1/2007
1-JAN-07 JAN 1/1/2007 1:01:50 PM
11-FEB-11 FEB 2/11/2011 3:39:38 PMI want another column with Yr as 2007 instead of 07 etc
kindly guide me
thanks in advance
If you are planning to use this value as a number, it is more efficient to use EXTRACT instead. Using TO_CHAR and then inserting the value into a numeric variable or database column, means that Oracle must perform another datatype conversion to change your VARCHAR '2011' value to the number 2011. Even though you don't write it like this
TO_NUMBER ( TO_CHAR ( sysdate , 'YYYY' ) ) that's what Oracle does.
To go straight from a date to a number, then use EXTRACT:
EXTRACT ( YEAR FROM sysdate ) Edited by: dan.stober on Mar 3, 2011 9:21 AM
Similar Messages
-
How to get mm-dd-yyyy format in ssis
My destination is Oracle and i want the date to be in the below format while migrating data.
mm-dd-yyyy
SFHConsistent "MM/DD/YYYY"
format
(DT_DBTIMESTAMP)(SUBSTRING([date string], 7, 4) + "-" SUBSTRING([date string], 1, 2) + "-"
+ SUBSTRING([date string], 4, 2))
Refer the below link for more help on string conversions.
http://toddmcdermid.blogspot.ca/2008/11/converting-strings-to-dates-in-derived.html
Mudassar -
How to get date in dd/mm/yyyy format ?
Hello,
for this query :
>select to_date(to_char(sysdate),'dd/mm/yyyy') from dual;
i wanted to get date in dd/mm/yyyy format , but this query is not returning in correct date format .
How to get that ?select id,
to_date(to_char(dt1,'mm/dd/yyyy'),'dd/mm/yyyy') dt1,
to_date(to_char(dt2,'mm/dd/yyyy'),'dd/mm/yyyy') dt2
from t_table1 where no=23;This is my actual query.
But this query is giving error.
ORA-01843: not a valid monthWhen i issued this query :
select id,dt1,dt2 from t_table1 where no=23 ;
this is the output :
ID DT1 DT2
001 10/7/2011 10/19/2011Edited by: bootstrap on Oct 8, 2011 2:13 PM
Edited by: bootstrap on Oct 8, 2011 2:13 PM -
Unable to get date in yyyy.MM.dd format
Hi All
I am unable to get date in yyyy.MM.dd format.
I tried everything said in the previous postiongs.Nothig seem to work.
I am getting date in yyyy-MM-dd
This needs to be changed in said format. Also datatype should be date only.
Regards
PratyushYou can solve the problem in two ways
First way;
Format formatter = new SimpleDateFormat("yyyy.MM.dd");
String s = formatter.format(date);
OR
Assuming your context attribute name is Date
IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute("Date");
attributeInfo.getDataAttribute().getScalarType().format("yyyy.MM.dd");
Second way;
By changing the default Language of your browser. You have to check the format of each language and choose the language that gives the date in yyyy.MM.dd format.
Rgs,
Dni -
How to use MM/YYYY Format in the selection Screen?
There is this program RMCB0300 where the date format in the selection screen has MM/YYYY Format.
I am working on a report which requires it "Period" Field in the selection screen to be in the same format.
However, i am trying to give the select option as " SL_SPMON FOR S031-SPMON MODIF ID PER." and declaring S031 table in the declaration part.
But still, its not been able to provide me F4 help in the inpur screen.
Can someone please provide me some guidance in this regard?Hi,
the following works for me..
*& Report ZPMONAT *
report zpmonat .
tables: s031.
selection-screen begin of block abc.
select-options: sl_spmon for s031-spmon.
selection-screen end of block abc.
at selection-screen on value-request for sl_spmon-low.
perform monat_f4.
at selection-screen on value-request for sl_spmon-high.
perform monat_f4.
start-of-selection.
end-of-selection.
*& Form monat_f4
* text
* --> p1 text
* <-- p2 text
form monat_f4 .
data: begin of mf_dynpfields occurs 1.
include structure dynpread.
data: end of mf_dynpfields.
data: mf_returncode like sy-subrc,
mf_monat like isellist-month,
mf_hlp_repid like sy-repid.
field-symbols: <mf_feld>.
* Wert von Dynpro lesen
get cursor field mf_dynpfields-fieldname.
append mf_dynpfields.
mf_hlp_repid = sy-repid.
do 2 times.
call function 'DYNP_VALUES_READ'
exporting
dyname = mf_hlp_repid
dynumb = sy-dynnr
tables
dynpfields = mf_dynpfields
exceptions
invalid_abapworkarea = 01
invalid_dynprofield = 02
invalid_dynproname = 03
invalid_dynpronummer = 04
invalid_request = 05
no_fielddescription = 06
undefind_error = 07.
if sy-subrc = 3.
* Aktuelles Dynpro ist Wertemengenbild
mf_hlp_repid = 'SAPLALDB'.
else.
read table mf_dynpfields index 1.
* Unterstriche durch Blanks ersetzen
translate mf_dynpfields-fieldvalue using '_ '.
exit.
endif.
enddo.
if sy-subrc = 0.
* Konvertierung ins interne Format
call function 'CONVERSION_EXIT_PERI_INPUT'
exporting
input = mf_dynpfields-fieldvalue
importing
output = mf_monat
exceptions
error_message = 1.
if mf_monat is initial.
* Monat ist initial => Vorschlagswert aus akt. Datum ableiten
mf_monat = sy-datlo(6).
endif.
call function 'POPUP_TO_SELECT_MONTH'
exporting
actual_month = mf_monat
importing
selected_month = mf_monat
return_code = mf_returncode
exceptions
factory_calendar_not_found = 01
holiday_calendar_not_found = 02
month_not_found = 03.
if sy-subrc = 0 and mf_returncode = 0.
* ASSIGN (MF_DYNPFIELDS-FIELDNAME) TO <MF_FELD>. " ==>> note 148804
* <MF_FELD> = MF_MONAT.
call function 'CONVERSION_EXIT_PERI_OUTPUT'
exporting
input = mf_monat
importing
output = mf_dynpfields-fieldvalue.
collect mf_dynpfields.
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = mf_hlp_repid
dynumb = sy-dynnr
tables
dynpfields = mf_dynpfields
exceptions
invalid_abapworkarea = 01
invalid_dynprofield = 02
invalid_dynproname = 03
invalid_dynpronummer = 04
invalid_request = 05
no_fielddescription = 06
undefind_error = 07. "<<== note 148804
endif.
endif.
endform. " monat_f4
Regards,
Suresh Datti -
How to convert date from "yyyymmdd" to "MM/DD/YYYY" format
1. I have one BLDAT field in my internal table.
its getting updated from input file.
2. The value in the input file is like yyyymmdd.
So the internal table field is filled like this
"YYYYMMDD".
3. After this,I have to compare this internal table
field with BSAD table.
4. The BLDAT field in BSAD table is in the format of
"MM/DD/YYYY".
5. the BLDAT field is having diff format in internal table and BSAD table.So I am unable to check this value.
How to convert it as like the BSAD table format."MM/DD/YYYY" format.
Thanks in advance!!Using the WRITE statement
data: gd_date(10). "field to store output date
* Converts date from 20020901 to 09.01.2002
write sy-datum to gd_date mm/dd/yyyy.
OR u can
CONCATENATE gd_date+4(2) gd_date+6(2) gd_date+0(4)
into gd_date seperated by '/' .
Hope this helps.
Kindly reward points and close the thread for the
answer which helped u OR get back with queries. -
Insertion of date in dd-mmm-yyyy format
I have a jsp page, from that i can enter values in oracle database.
my jsp page is working, but the problem is that it can only accept the date
dd-mmm-yyyy format. i.e 20-jun-2004, but when i enter date in dd/mm/yyyy format i.e 20/06/2004, it does not accept.
i want to enter to do enter date in dd/mm/yyyy format in the form, and it can save the date field in database in dd-mmm-yyyy format.
my code is as bellow:
<html>
<body>
<table>
<tr>
<td>
<%@ page import =" java.sql.Date.*" %>
<%@ page import =" java.text.SimpleDateFormat.*" %>
<%@ page import =" java.util.Date.*" %>
<%@ page import =" java.text.*" %>
<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page language="java" import="java.sql.*" %>
<%
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbc:odbc:pf","scott","ttlscott");
System.out.println("got connection");
%>
<%
char pay_post,pay_type;
String action = request.getParameter("action");
if (action != null && action.equals("save")) {
conn.setAutoCommit(false);
PreparedStatement pstmt = conn.prepareStatement(
("INSERT INTO pay_header VALUES (?, ?, ?, ?, ?, ?,?,?)"));
pstmt.setString(1,request.getParameter("vou_no"));
pstmt.setString(2,request.getParameter("pay_date"));
pstmt.setString(3,request.getParameter("pay_post"));
pstmt.setString(4,request.getParameter("pay_narr"));
pstmt.setString(5, request.getParameter("chq_no"));
pstmt.setString(6,request.getParameter("chq_date"));
pstmt.setFloat(7,Float.parseFloat(request.getParameter("chq_amt")));
pstmt.setString(8,request.getParameter("pay_type"));
pstmt.executeUpdate();
conn.commit();
conn.setAutoCommit(true);
%>
<%
Statement statement = conn.createStatement();
ResultSet rs = statement.executeQuery
("SELECT * FROM pay_header ");
%>
<tr>
<form action="payment_save1.jsp" method="get">
<input type="hidden" value="save" name="action">
<th><input value="" name="vou_no" size="10"></th>
<th><input value="" name="pay_date" size="10"></th>
<th><input value="" name="pay_post" size="15"></th>
<th><input value="" name="pay_narr" size="15"></th>
<th><input value="" name="chq_no" size="15"></th>
<th><input value="" name="chq_date" size="15"></th>
<th><input value="" name="chq_amt" size="15"></th>]
<th><input value="" name="pay_type" size="15"></th>
<th><input type="submit" value="save"></th>
</form>
</tr>
<%
while ( rs.next() ) {
%>
<tr>
<form action="payment_save1.jsp" method="get">
<input type="hidden" value="save" name="action">
<td><input value="<%= rs.getString("vou_no") %>" name="vou_no"></td>
<td><input value="<%= rs.getDate("pay_date") %>" name="gl_descr"></td>
<td><input value="<%= rs.getString("pay_post") %>" name="pay_post"></td>
<td><input value="<%= rs.getString("pay_narr") %>" name="pay_narr"></td>
<td><input value="<%= rs.getString("chq_no") %>" name="chq_no"></td>
<td><input value="<%= rs.getDate("chq_date") %>" name="chq_date"></td>
<td><input value="<%= rs.getFloat("chq_amt") %>" name="chq_amt"></td>
<td><input value="<%= rs.getString("pay_type") %>" name="pay_type"></td>
<td><input type="submit" value="save"></td>
</form>
</tr>
<%
%>
</table>
<%
// Close the ResultSet
rs.close();
// Close the Statement
statement.close();
// Close the Connection
conn.close();
} catch (SQLException sqle) {
out.println(sqle.getMessage());
} catch (Exception e) {
out.println(e.getMessage());
%>
</td>
</tr>
</body>
</html>thanx for u r help..
now i have used simple date format method and also apllied setDate() method.
bit its coming error NULL
code:
SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy");
java.util.Date pay_date_temp = null;
java.util.Date pay_post_temp = null;
PreparedStatement pstmt = conn.prepareStatement(
("INSERT INTO pay_header VALUES (?, ?, ?, ?, ?, ?,?,?)"));
java.sql.Date pay_date = new java.sql.Date(pay_date_temp.getTime());
java.sql.Date chq_date = new java.sql.Date(pay_post_temp.getTime());
pstmt.setString(1,request.getParameter("vou_no"));
pstmt.setDate(2,pay_date);
pstmt.setString(3,request.getParameter("pay_post"));
pstmt.setString(4,request.getParameter("pay_narr"));
pstmt.setString(5, request.getParameter("chq_no"));
pstmt.setDate(6,chq_date);
pstmt.setFloat(7,Float.parseFloat(request.getParameter("chq_amt")));
pstmt.setString(8,request.getParameter("pay_type"));
help me -
Insert date in dd-mmm-yyyy format
I have a jsp page, from that i can enter values in oracle database.
my jsp page is working, but the problem is that it can only accept the date
dd-mmm-yyyy format. i.e 20-jun-2004, but when i enter date in dd/mm/yyyy format i.e 20/06/2004, it does not accept.
i want to enter to do enter date in dd/mm/yyyy format in the form, and it can save the date field in database in dd-mmm-yyyy format.
my code is as bellow:
<html>
<body>
<table>
<tr>
<td>
<%@ page import =" java.sql.Date.*" %>
<%@ page import =" java.text.SimpleDateFormat.*" %>
<%@ page import =" java.util.Date.*" %>
<%@ page import =" java.text.*" %>
<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page language="java" import="java.sql.*" %>
<%
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbc:odbc:pf","scott","ttlscott");
System.out.println("got connection");
%>
<%
char pay_post,pay_type;
String action = request.getParameter("action");
if (action != null && action.equals("save")) {
conn.setAutoCommit(false);
PreparedStatement pstmt = conn.prepareStatement(
("INSERT INTO pay_header VALUES (?, ?, ?, ?, ?, ?,?,?)"));
pstmt.setString(1,request.getParameter("vou_no"));
pstmt.setString(2,request.getParameter("pay_date"));
pstmt.setString(3,request.getParameter("pay_post"));
pstmt.setString(4,request.getParameter("pay_narr"));
pstmt.setString(5, request.getParameter("chq_no"));
pstmt.setString(6,request.getParameter("chq_date"));
pstmt.setFloat(7,Float.parseFloat(request.getParameter("chq_amt")));
pstmt.setString(8,request.getParameter("pay_type"));
pstmt.executeUpdate();
conn.commit();
conn.setAutoCommit(true);
%>
<%
Statement statement = conn.createStatement();
ResultSet rs = statement.executeQuery
("SELECT * FROM pay_header ");
%>
<tr>
<form action="payment_save1.jsp" method="get">
<input type="hidden" value="save" name="action">
<th><input value="" name="vou_no" size="10"></th>
<th><input value="" name="pay_date" size="10"></th>
<th><input value="" name="pay_post" size="15"></th>
<th><input value="" name="pay_narr" size="15"></th>
<th><input value="" name="chq_no" size="15"></th>
<th><input value="" name="chq_date" size="15"></th>
<th><input value="" name="chq_amt" size="15"></th>]
<th><input value="" name="pay_type" size="15"></th>
<th><input type="submit" value="save"></th>
</form>
</tr>
<%
while ( rs.next() ) {
%>
<tr>
<form action="payment_save1.jsp" method="get">
<input type="hidden" value="save" name="action">
<td><input value="<%= rs.getString("vou_no") %>" name="vou_no"></td>
<td><input value="<%= rs.getDate("pay_date") %>" name="gl_descr"></td>
<td><input value="<%= rs.getString("pay_post") %>" name="pay_post"></td>
<td><input value="<%= rs.getString("pay_narr") %>" name="pay_narr"></td>
<td><input value="<%= rs.getString("chq_no") %>" name="chq_no"></td>
<td><input value="<%= rs.getDate("chq_date") %>" name="chq_date"></td>
<td><input value="<%= rs.getFloat("chq_amt") %>" name="chq_amt"></td>
<td><input value="<%= rs.getString("pay_type") %>" name="pay_type"></td>
<td><input type="submit" value="save"></td>
</form>
</tr>
<%
%>
</table>
<%
// Close the ResultSet
rs.close();
// Close the Statement
statement.close();
// Close the Connection
conn.close();
} catch (SQLException sqle) {
out.println(sqle.getMessage());
} catch (Exception e) {
out.println(e.getMessage());
%>
</td>
</tr>
</body>
</html>thanx for u r help..
now i have used simple date format method and also apllied setDate() method.
bit its coming error NULL
code:
SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy");
java.util.Date pay_date_temp = null;
java.util.Date pay_post_temp = null;
PreparedStatement pstmt = conn.prepareStatement(
("INSERT INTO pay_header VALUES (?, ?, ?, ?, ?, ?,?,?)"));
java.sql.Date pay_date = new java.sql.Date(pay_date_temp.getTime());
java.sql.Date chq_date = new java.sql.Date(pay_post_temp.getTime());
pstmt.setString(1,request.getParameter("vou_no"));
pstmt.setDate(2,pay_date);
pstmt.setString(3,request.getParameter("pay_post"));
pstmt.setString(4,request.getParameter("pay_narr"));
pstmt.setString(5, request.getParameter("chq_no"));
pstmt.setDate(6,chq_date);
pstmt.setFloat(7,Float.parseFloat(request.getParameter("chq_amt")));
pstmt.setString(8,request.getParameter("pay_type"));
help me -
Show date in dd/mm/yyyy format using ODataModel in a table.
Hi,
I am populating a table using ODataMoel in which one of the columns is 'DatePicker' control and I want to map a date being passed in one of the fields of data from server to this DatePicker control. It's getting mapped but I want to show the date in DatePicker in 'dd/mm/yyyy' format.
I happened to go through links but they were talking about JSonModel.
How would that be implemented using ODataModel. Please find my sample code below.
var oTable = new sap.ui.table.Table("dprTable",{
visibleRowCount: 4,
//firstVisibleRow: 3,
visible: true,
navigationMode: sap.ui.table.NavigationMode.Paginator
//selectionMode: sap.ui.table.SelectionMode.Single
var oColumn = new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "DBR/DPR"}),
template: new sap.m.Link({
"target": "_blank",
press:[controller.onClickDemoNo,controller]
}).bindProperty("text","DemoId")
width: "auto"
oTable.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Required Date"}),
template: new sap.ui.commons.DatePicker("",{
value:{
path:"/ReqDate",
type: new sap.ui.model.type.Date({pattern: "yy-MM-dd"})
change: function(){
console.log('the date is changed and it\'s value is'+value);
width: "auto"
oTable.addColumn(oColumn);
var oModel = new sap.ui.model.odata.ODataModel("/sap/opu/odata/sap/ZSECENTRAL_SRV",true);
oTable.setModel(oModel);
oTable.bindRows("/DEOPENDBRSet");
This(red colored code) is not showing the date in the DatePciker in the form of 'dd/mm/yyyy', in fact it's not populating the date too. Any help would be appricitated.
Thanks,
Supriya KaleHi Supriya,
Just give the source pattern of the date and remove the / in the path mentioned.
Please make sure that the source pattern is correct.
template = new sap.ui.commons.DatePicker({
value:{
path:"ReqDate",
type: new sap.ui.model.type.Date({source: {pattern: "yyyyMMdd"},pattern: "yy-MM-dd"})
Hope it works.
Regards,
Jeffin George -
SSRS Datetime Parameter value should display in DD/MM/YYYY format
Hi All
we have 2 Datetime parameters in my report , where the value is shouwing in MM/DD/YYYY format . i have modified the language type of report to Fr-BE but there is not change . Users want to see the date value in DD/MM/YYYY format . how can we achieve this
Surendra ThotaI have this same issue on my new laptop (suffering with it for about 9 months actually). I used to work around it by launching Visual Studio as a different user. That doesn't work anymore as I can't get the report preview to display when run
as another user (apparently that's an issue reported in other forum threads).
I lodged something on Connect about this quite a while ago and the op there was also quite unhelpful. Using expressions and so on is NOT an option. It's impossible to preview a report using date pickers now as it seems the control validates using
one format and then the engine seems to immediately validate using the other. I suppose an ambiguous date like 3/2/2013 (Feb or March?) would "work" but is hardly nice. There's a lot more detail in this thread
http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/a5e40392-2bf8-432e-89f5-3a948fc3ea7a and the subsequent Connect issue I filed
https://connect.microsoft.com/SQLServer/feedback/details/750202/date-picker-in-reporting-services-2008-r2-visual-studio-designer-wrong-formatting#tabs .
The new SQL 2012 tools that were released a couple of months ago that us VS2012 as the designer still have the same flaw. I've just tried opening a Microsoft support incident but the issue opening tool seems broken as any selection of a SQL Server
product results in 404s :(
Anyway, the other forum thread may be able to help others or at least help clarify the problem we're experiencing. I'm apply CU4 for SQL 2012 at the moment plus I saw there's a release of the VS2012 "BIDS" tools to get on the CU4 page - maybe it's
a new version? I'm hoping so :)
Ian Yates Technical Manager Medical IT Pty Ltd PO Box 501, Carina QLD 4152 Australia Web: www.medicalit.com.au -
Please enter the expiry date in dd.mm.yyyy format
Dear All,
I have configured SAP AA in Dev. Now I want to craete asset master. But it is showing the following error, when I am going to save:
Please enter the expiry date in dd.mm.yyyy format
Can anyone tell me the solution?
Thanks
AzimulThanks Jigar for your reply.
My company is using SAP last 2.5 years. During SAP Implementation, Consultants configured SAP AA, but during testing it showed error in Asset Accounting. That is why, we donu2019t use SAP AA.
Now we want to use Asset Accounting in SAP. I have configured SAP AA in Development. Then I try to Create Asset Master, But it is showing Error:
Please enter the expiry date in dd.mm.yyyy format
I cannot get Error message no also. If I double click on error, it is not opening.
I donu2019t know about Validations. Can u please guide me?
Thanks,
Azimul
Edited by: Azimul on Oct 1, 2011 7:58 AM -
Converting Year in YYYY format for return in select list
Using Apex 4.1.1 on Linux (Apex Listener on glassfish)
I have a table with week ending dates and use this table for as my LOV.
The select list comes up like 12-SEP-12 when I check the value attribute in Firebug. Problem is that this comes up as year 0012 instead of 2012 when I try to use it in my PL SQL code to save it to a table.
Is there a way I can get the return value for the year in YYYY format for return value in select list? Have tried to_date(dt, 'DD-MON-YYYY') with no luck.
Cheers.All APEX session state values are held as VARCHAR2s. Explicit conversion to and from DATE values using specified formats is recommended. Convert to VARCHAR2 in the LOV query:
select to_char(week_ending, 'DD-MON-YYYY') l, to_char(week_ending, 'YYYY-MM-DD') v from ...and to DATE in the PL/SQL process code:
...to_date(:p1_week_ending, 'YYYY-MM-DD')...I'm trying to standardise on using ISO 8601 representations for non-displayed date values. These are unambiguous, sort properly using character semantics, and are compatible with other systems and technologies. -
Convert DD-MON-YYYY format to MM/DD/YYYY
I have an input date variable L_DATE as 11-Aug-2013(DD-MON-YYYY).
In my procedure, I am converting the input date to MM/DD/YYYY format .
The logic I have used for the same in my Stored Proc- COMPARE2 is:
R_DATE := to_char(to_date(L_DATE,'DD-MON-YYYY'),'MM/DD/YYYY');
But this is the error that I get when the SP is run:
ORA-01843: not a valid month
ORA-06512: at "COMPARE2", line 51
ORA-06512: at line 2
Can anyone suggest how to resolve this??Input data doesnt match NLS_DATE_LANGUAGE setting
Consider
select * from v$nls_parameters
where
parameter ='NLS_DATE_LANGUAGE'
PARAMETER VALUE
NLS_DATE_LANGUAGE AMERICAN
select
to_char(to_date('11-MAY-2013','DD-MON-YYYY'),'MM/DD/YYYY') d
from dual
D
05/11/2013
select
to_char(to_date('11-MAY-2013','DD-MON-YYYY','NLS_DATE_LANGUAGE=GERMAN'),'MM/DD/YYYY') d
from dual
ORA-01843: not a valid month
or
The month is not given literally
select
to_char(to_date('11-05-2013','DD-MON-YYYY'),'MM/DD/YYYY') d
from dual
ORA-01843: not a valid month -
Converting string to date in mm/dd/yyyy format
Hi,
I used simpledateformat to convert date to "MM/dd/yyyy" format.
Now when i want to insert into db, i want the value as date object instead of string [returned by format method of SimpleDateFormat]
what should i do?
Date dt = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
System.out.println("Formatted date is coming as "+sdf.format(dt));
Date dt1 = sdf.parse(sdf.format(dt);
System.out.println("parsed date is coming as " +dt1);
output :
1 SOP returns 11/07/2007 [current date]
2 SOP returns Wed Nov 07 00:00:00 GMT+05:30 2007If you are using PreparedStatements setDate method, you need a java.sql.Date object, not a Java.util.Date object. You can create an sql.Date object from a util.Date object as follows:
java.sql.Date sqlDate = new java.sql.Date(dt.getTime());And, if you are not using PreparedStatement and its setDate method, then change now.
Doing
Date dt1 = sdf.parse(sdf.format(dt));is meaningless. You format the date to string, then parse the string back to a date? Why? Why not just use the original Date object? And you won't get a sql.Date object that way, either, as the DateFormat classes return a util.Date object.
Edit: And for more info:
A Date does not have a format. It is simply a number. The "format" only comes into play when printing the String representation of the Date, and that is not handled by the Date object itself (except when calling toString either explicitly or implicitly). -
Date to show in MM/DD/YYYY format
Hi all,
I am stumped on this simple thing under BIP.How can I get the date to show in MM/DD/YYYY format under BIP ?
Template is created under word, for the field under formatting, type: date, format:M/d/yyyy ( can't find MM/DD/YYYY). But when I browse the document, it always show as "DD-MON-YYYY" format.
How to mitigate this ?
Thanks
MunsharHi ,
hey small mistake in my solution code,just change the format to dd/MM/yyyy (case sensitive code)then it will work
to-char() is used to convert the Date or Number format type to displayable string format.
In our case also it is coverting xml_date_filed into a string to the format of dd/MM/yyyy
so you can try with this formula
in Advanced tab write
*<?xdofx:to_char(MY_DATE_FIELD,'dd/MM/yyyy')?>*
or in properties tab ,under formatting section ,select type as DATE and write the format as dd/MM/yyyy
best/Aravind
Edited by: Aravind on Aug 18, 2011 9:58 AM, with correct solution
Maybe you are looking for
-
Siebel Web Client crashes when clicking a certain view (Income).
We are using Siebel Public Sector and I am encountering a recurring issue with our Siebel Web Client. For most part it works but something strange occurs when I execute a series of steps. Whenever I go to the Contacts Screen > Income View then click
-
Panel content not loaded in non-english Photoshop
Hello. I have created this Panel ( http://circografico.com.ar/shop/downloads/ad-artbox-lite/ ) that works perfect in Photoshop CS6 - english version - both in Windows and Mac, but when someone try to use it in a spanish Photoshop version, it loads a
-
Can we call a Function Module with in a loop
Hi, Can we call a Function Module within a loop . Does it reduces the performance. Can you please guide regarding this. With Best Regards Mamatha.
-
Dear Adobe Acrobat Team, I am adding an annotation and a digital signature to a pdf document through my being-developed application, however when open that pdf with adobe acrobat, it validates the signature, and reports that "Annotations Modified" un
-
I agree to itunes update sends email to me and no place lets me check that i agree so what am i suppose to do ?