Different date format conversion?
consider,
i have a input like
13/12/2008 (dd/mm/yyyy) or 13-12-2008,
I want to change the above format to 12/13/2008 (mm/dd/yyyy) or 12-13-2008.
Is it possible? Is there any function available?
Please advise.
Parse your date into a Date using a DateFormat/SimpleDateFormat.
Then format that Date to a String using another DateFormat/SimpleDateFormat.
Similar Messages
-
Different Date Formats in the same "From"
Hello
We used different date formats depending on the users language.
In a report this is simple to implement ... read the date field twice (in different formats dd/mm/yyyy and mm/dd/yyyy) and display only one based on the language.
I want to be able to do the same in a "form" which updates a date. In this case the about is not allowed.
Has anyone have solution for this using "APEX" forms or do a need to write a process to achieve this?
Thanks
PetePete,
You don't specify what version of Application Express you're using, so I'll assume APEX 3.1 or later.
Are you setting the date format yourself, based upon the user's language?
1) You could have the application's language derived from Browser, and then APEX would automatically set the NLS_LANGUAGE and NLS_TERRITORY settings accordingly. Then, I would simply use 'DS' as the Application Date Format. For Date Pickers on a form, I would use item type 'Date Picker (use Application Date Format)'.
2) If you're already determining the date format yourself and you don't want APEX to do it for you, ensure that you are setting this value in an application item (e.g., PETE_DATE_FORMAT). Then, you could still use Application Date Format with a value of &PETE_DATE_FORMAT. (inclusive of the trailing period).
When you use Application Date Format, the conversion should happen automatically for you so that you don't have to code this yourself on the Form.
I hope this helps.
Joel -
Problem with SQL*Loader and different date formats in the same file
DB: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
System: AIX 5.3.0.0
Hello,
I'm using SQL*Loader to import semi-colon separated values into a table. The files are delivered to us by a data provider who concatenates data from different sources and this results in us having different date formats within the same file. For example:
...;2010-12-31;22/11/1932;...
I load this data using the following lines in the control file:
EXECUTIONDATE1 TIMESTAMP NULLIF EXECUTIONDATE1=BLANKS "TO_DATE(:EXECUTIONDATE1, 'YYYY-MM-DD')",
DELDOB TIMESTAMP NULLIF DELDOB=BLANKS "TO_DATE(:DELDOB, 'DD/MM/YYYY')",
The relevant NLS parameters:
NLS_LANGUAGE=FRENCH
NLS_DATE_FORMAT=DD/MM/RR
NLS_DATE_LANGUAGE=FRENCH
If I load this file as is the values loaded into the table are 31 dec 2010 and 22 nov *2032*, aven though the years are on 4 digits. If I change the NLS_DATE_FORMAT to DD/MM/YYYY then the second date value will be loaded correctly, but the first value will be loaded as 31 dec *2020* !!
How can I get both date values to load correctly?
Thanks!
SylvainThis is very strange, after running a few tests I realized that if the year is 19XX then it will get loaded as 2019, and if it is 20XX then it will be 2020. I'm guessing it may have something to do with certain env variables that aren't set up properly because I'm fairly sure my SQL*Loader control file is correct... I'll run more tests :-(
-
URGENT: XML-SQL: Error parsing different date formats in the same XML file.
Hi Everyone,
I have a big problem while using the XML-SQL utility. I have a XML file with different date formats. I get exception like the one below.
"oracle.xml.sql.OracleXMLSQLException: 'java.text.ParseException: Unparseable date:"
And the XML file is :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Info Key="ID">
<Insert>
<ID>1</ID>
<BookingDate>10.12.2001</BookingDate>
<OpeningTime>19:16</OpeningTime>
</Insert>
</Info>
I have tried using different setDateFormat which is contrary.
sav.setDateFormat("d.M.y");
sav.setDateFormat("H:m:s");
Can someone help me on the same.
Thanks in advance.
Subramanian.You might have to describe the columns as varchar then modify the table to the right format.
-
Different Date Formats on CRM and BI Client
Hi,
When trying to run the CRM Interactive Report "Accounts with Open Activities", I receive the following error:
Different date formats on CRM and BI client 01/13/2009 13.01.2009 SC5CLNT200
Does anybody know how to resolve this error?
ThanksHi Peter,
As far as i remember, I had the same issue.
Once I matched the date format in reporting client using SU01 on default tab with CRM date format, I did't see the error again.
Did you try restarting the Browser & also relogin GUI.
Else lets see what else can be done.
Best Regards
Shiven -
RE: Oracle DATE data format conversion..
<C.M> Motta's question about dates and oracle>
Dealing with dates and Oracle is somewhat of a nuisance. Oracle is very
particular about how date strings are formatted, and if you get it wrong,
you get the (unhelpful) message that C.M. Motta showed us. However, if
you pass a DateTimeData to Oracle, Forte' does the right formatting for you.
If you do need to format the date prior to interacting with Oracle, use the
following format:
dd-mmm-yy <time component>
You can change the default format, but it is not easy.
If you customise Express generated code that interacts with an Oracle
database, again, make sure that you pass a DateTimeData, and not the
.TextValue.
Good luck!
Richard KirkDate: Wed, 06 Nov 1996 08:18:37 -0500
To: "C. M. Motta" <[email protected]>
From: Jim Milbery <[email protected]>
Subject: Re: Oracle DATE data format conversion..
Cc: [email protected]
Cheers:
Most likely what is happening is that you are using the default date
format of Oracle, and you are sending a four-character year. As follows:
SQL> insert into jimbo values ('01-dec-1997')
2 /
insert into jimbo values ('01-dec-1997')
ERROR at line 1:
ORA-01830: date format picture ends before converting entire inputstring
>
Oracle defaults to a format of 'dd-MON-yy'
You can either truncate the year, or manipulate the date to match the standard
database as follows:
insert into jimbo values (to_Date('01-jan-1997', 'DD-MON-YYYY'))
\jimbo
At 09:21 AM 11/6/96 -0200, you wrote:
Forte Users,
First, Id like to thank all those who answered my question on
droplist & SQL. I got just what I was looking for: its up and runnunig
now.
I have another question: Im trying to insert a DATE into an Oracle
database. The source date is:
data : DateTimeData = new;
data.SetCurrent();
So, when I try to insert data.Value or data.textvalue into DB, I
get the following exception:
ORA-01830: date format picture ends before converting entire
input string.
Are there any suggestions?
Thanks for your help,
C.M. Motta
====================================================================
Jim Milbery
Milbery Consulting Group
132 N. West St., Allentown, PA 18102
O: 610 - 432 - 5350 F: 610 - 432 - 5380
E-Mail : [email protected]
==================================================================== -
Regarding Date Format Conversion
Hi,
In my project i am picking the date from the date picker which is a javascript program . Then i am displaying it on a jsp page .It is coming in mm/dd/yyyy format .I have to change it to dd/mm/yyyy format .
I have the code for date formatting conversion .
What my doubt is whether the code should be written inside the jsp page or in the javascript .
Thanks .Hi
<%@page language="java" import="java.sql.*,java.util.*,java.text.*" %>
<%SimpleDateFormat sdf= new SimpleDateFormat(dd/mm/yyyy );%>
<% java.util.Date temp_date = sdf.parse(PassYourDateHere); %>
use this with your jsp
Regards
Abhijith YS -
Trigger returning different date formats.
Posted from Windows forum:
We just reticently received a update to an .net application from a vendor. When our client machines (Windows XP) run the app we receive 2 different date formats returned from an post insert table trigger. The correct format is 'DD-MON-YY' in which a couple machines still return and the others return the format 'YYYY-MM-DD HH24:MM:SS'. I've tried setting the NLS_Date Format with no success. Database is Oracle 8i. Any suggestions?CREATE TABLE X.ACCESS_LOG
ACCESS_LOG_ID NUMBER NOT NULL,
SYS_ID NUMBER NOT NULL,
DATE_IN DATE NOT NULL,
DATE_OUT DATE NOT NULL,
INSTRUMENT_ID_IN NUMBER,
INSTRUMENT_ID_OUT NUMBER,
STATION_IN VARCHAR2(20),
STATION_OUT VARCHAR2(20),
AREA_IN VARCHAR2(25),
AREA_OUT VARCHAR2(25)
CREATE OR REPLACE TRIGGER XFER_TO_TRACKING
AFTER INSERT
ON x.ACCESS_LOG
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
v_qtr Number;
BEGIN
SELECT qtr
INTO v_Qtr
FROM X.QTR_SET
WHERE to_date(:new.Date_In,'dd-mon-yy') BETWEEN first_date AND last_date;
Insert (....)
END/
Here is the basic code for table and trigger. When the trigger fires the value for :new.date_in will come over in the format of "dd-mon-yy", which we have been looking for, or "YYYY-MM-DD HH24:MM:SS" which just came up with this new release depending on which station is used. -
Hi All,
I'm using OWB,Disc Admin and Disc Plus. The problem i'm having is, In the OWB Target Table i have a date field in the following format "DD-MM-YYYY HH:MM:SS AM/PM", but when i bring the filed into a report in Disco Plus i'm seeing it in the format "DD-MM-YYYY". I went onto Disco Admin and opened the folder and edited the Date field to the "DD-MM-YYYY HH:MM:SS" field, but still its not showing the changes made in Admin. Any suggestions why its showing different date formats?
ThanksHi
Discoverer shows dates as dates. The time elements are still there. If you want to see them use the TO_CHAR function.
Best wishes
Michael -
How to extract different date format in text file
well, iam new for using regex api(regular expression), In my project i want to extract the different format of date from the text file... date format will be 3rd june 2004, 03-06-2004, june 3rd and so on....
can any body give me regular expression to extract the date from the text file...
i will be very grateful..
kareemdate format will be 3rd june 2004, 03-06-2004, june 3rd and so on....The only way to do this (without implementing a "mind reader") is to determine in advance all the possible date formats that are possible in your input, and try to interpret each date using each of those formats until one of them passes.
It's easy enough to handle june 3rd vs 3 june vs 3rd june, but 6/3 vs 3/6, of course, is ambiguous. -
Why are 2 different date formats being used in thunderbird?
Hello
in the attachment you will see that the listing of emails (on the left) is shown using UK date format DD/MM/YY (that's what I want), however, the message content panel shows the date in the US format MM/DD/YY (I definitely do not want this).
Why are 2 different formats being applied in Thunderbird, and how can I get both to be UK DD/MM/YY please.
Many thanks
Lord ElpusI should have said :
this is Thunderbird 31.6.0 on Ubuntu 14.04 LTS
Image resent due to previous failure. -
The priority of different data type conversion
Hi All,
I want to know the priority of data type conversion rule. if in an expression, I have several kind of data type( I, P, F,N..).
Then finaly, all the data object will convert to which data type?
I don't know the priority of data conversion.
E.g. data a type i. data b type p. data c type f.
a = b + c.
or data d type p, data e type f.
if ( d > f ).
Then who will convert to who's type?
Thanks and Regards.
AaronFor expressions, the right term in SAP is "calculation type", it's explained here : [abap help - determining the calculation type|http://help.sap.com/abapdocu_70/en/ABENARITH_TYPE.htm]. SAP takes the "biggest" type of all variables in the expression. It can be I, P or F (smallest is I, biggest is F).
Conditions are handled differently, just using data type conversion (see link given above by Abhishek), SAP converts from smallest to biggest type (in your case, it converts P to F and compares the two F variables). -
Date format conversion in BEX query level
Hi ,
We had a date field in the numeric format like 735.020 in the cube level, but when we execute the query the values for thsi date field is changed in to date format like 31.05.2013.
we are not having any conversion routines and the date fields are used directly in the query .Hi,
Try the below class file or may be create a method in your controller. It will resolve your problem.
package com.XXX.DateFormatForSAP;
import java.util.Date;
import java.text.SimpleDateFormat;
public class FormatSAPDate {
public static String changeDateFormat(Date sapDate) {
String formattedDate = null;
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
formattedDate = dateFormat.format(sapDate);
return formattedDate;
Try this code and let me know.
Regards
Mukesh -
Problem with date format conversion
Hi All,
I was trying to load from a flat-file to an ods through psa. the file has a date format which is mm/dd/yyyy. i want to convert that to yyyymmdd. i created a custom object ZDAT for this field of type char with length 10. i wrote a code in transfer routine for the conversion as follows:
DATA : ZT1 LIKE SYST-DATUM,
STR1 TYPE STRING,
STR2 TYPE STRING,
STR3 TYPE STRING.
SPLIT TRAN_STRUCTURE-/BIC/ZDAT AT '/'
INTO STR1 STR2 STR3.
CONCATENATE STR3 STR1 STR2 INTO ZT1.
RESULT = ZT1.
it reported error in PSA records while loading aS " Infoobject /BIC/ZDAT does not contain alpa-conforming value 20050321.
P.s: for this record i was abt to load 03/21/2005 to zdat.
thanks,
anitha.hi anitha!
ok!
in the transferrules you use the ZDAT as an field for date in transferstructure. but in info source use the 0calday.
so now
you need to write your routine in the transfer rules for 0calday which can be derived from zdat which can be derived from the zdat.
so your Transfer structure will be same as
zmid, zmatgrp, zdat, zcid, zloc, zqty
But your Info source must be like
zmid, zmatgrp, 0calday, zcid, zloc, zqty
and in transfer rule i suggest you to use the following code for the 0calday.
DATA : ZT1 LIKE SYST-DATUM,
STR1 TYPE char(2),
STR2 TYPE char(2),
STR3 TYPE char(4).
SPLIT TRAN_STRUCTURE-/BIC/ZDAT AT '/'
INTO STR1 STR2 STR3.
CONCATENATE STR3 STR1 STR2 INTO ZT1.
RESULT = ZT1.
hope it makes things clear....
with regards
ashwin
Message was edited by: Ashwin Kumar Gadi -
Date format conversion in PL/SQL
Hi,
am new to pl/sql can any one please tel me how to wright a function to convert date format.
I have date in database with different formats, the data type of the date in database is 'VARCHAR'. I want to convert the date format to standard format say 'DD-MON-YYYY'.
In database i have different formats of date like 'dd-mon-yyyy',dd/mm/yyyy,dd.mm.yyyy,dd.mm.yy,MON DD,YYYY etc with some other formats also..
Please tel me how to wright a function in pl/sql to convert date in to standard format.
Thanks in advance.Ooops, which idiot stored dates as strings? That was silly.
You'll have to aim to recognise each format... e.g.
SQL> ed
Wrote file afiedt.buf
1 with t as (select 1 as id, '01/02/2008' as dt from dual union all
2 select 2, '14.07.2007' from dual union all
3 select 3, 'APR-21-2007' from dual union all
4 select 4, 'NONSENSE' from dual)
5 -- END OF TEST DATA
6 select id,
7 CASE WHEN regexp_like(substr(dt,3,1), '[\.,\/]') THEN
8 CASE WHEN length(dt) = 8 THEN
9 TO_DATE(dt, 'DD/MM/YY')
10 ELSE
11 TO_DATE(dt, 'DD/MM/YYYY')
12 END
13 WHEN regexp_like(dt, '^([[:alpha:]]){3}-') THEN
14 TO_DATE(dt, 'MON/DD/YYYY')
15 ELSE
16 NULL
17 END as date_dt
18* FROM t
SQL> /
ID DATE_DT
1 01/02/2008 00:00:00
2 14/07/2007 00:00:00
3 21/04/2007 00:00:00
4You're problem will come if you actually have dates stored as both DD/MM/YYYY and MM/DD/YYYY type formats because then you won't know if e.g.
01/02/2007
is
1st Feb 2007 or 2nd Jan 2007
Maybe you are looking for
-
How do I get my new iPod Touch 64 Gb to play music through my stereo system
As a newbie owner of an iPod Touch 64GB I am trying to figure out how to get music on my Touch to play through my home stereo system. Is there a way to use the output from the Touch via the earphone plug to input to a stereo pre-amplifier to play my
-
Now possible to scroll line-wrapped output in window of ModalDialog?
Hello, At some point the plugin I am working on must display a window with extracted values (varPathName), in this case the full-path-names to image files. Depending on the users selection there are many or only a few full-path-names in the output. T
-
Installing Mac OS X 10.4.7 DVD disk to a 2nd Hand G5 imac?
Hi trying to install my version of 10.4.7 which works on my ibook G4. But I recently bought a 2nd Hand G5 iMac 1.83 Ghz Intel duo. I loaded the disk and it does'nt seem to want to work? It's saying the destination is not suitable? Would I need to buy
-
External drive mounting in keyboard (USB 1) not in USB 2
After some days crying and many hours searching I found lots of USB-related issues, different OS versions, machines and external peripherals. My problem was with a Iomega USB2 external disk and a "brand new" Mac Pro Intel Xeon 2.66GHz. Many times plu
-
How do I uninstall the Iphone to Mac software with no delete button?
I downloaded the Iphone to Mac software to transfer my data from my phone into itunes on my new mac. However, now I'm getting pop ups about downloading other apps, which I think is caused by the app, and I also don't need it anymore. When I go to del