Converting date format yyyy-mm-dd to mm/dd/yyyy
Hi,
I need help converting the above date format. In the database the date is stored as a VARCHAR with the format yyyy-mm-dd
but I would like it changed to DATE with the format mm/dd/yyyy. I tried the following and I keep getting invalid month
select To_date(date_value, 'mm/dd/yyyy') as date_value from table
When I try to convert it to char first before converting to date I get an invalid number error
select to_date(to_char(date_value, 'mm/dd/yyyy'), 'mm/dd/yyyy') as date_value from table
What do I do?
Thanks for your help!!!
Hi,
The second argument of TO_DATE tells what format the first argument is already in.
So you want:
select To_date (date_value, 'yyyy-mm-dd') as date_value
from table_x;Format is a quality of strings, not DATEs. Once you have converted your string to a DATE, is is stored in the same internal format as all the other DATEs. Use TO_CHAR to display it in any format you like.
For example:
SELECT TO_CHAR ( TO_DATE (date_value, 'yyyy-mm-dd')
, 'mm/dd/yyyy'
FROM table_x;Things are much easier if you store dates in DATE columns.
Similar Messages
-
Convert date format from MONTH-YEAR to dd/mm/yyyy
Dear All
i want to get parameter in form of MONTH-YEAR AND WANT TO CONVERT DATE INTO 'THIS FORMAT dd/mm/yyyy' IT GIVES ME ERROR PLEASE GUIDE.
SELECT
TO_CHAR (PTP.END_DATE,'MONTH-YY') ,
to_date ( TO_CHAR (PTP.END_DATE ,'DD-MONTH-YYYY') ,'dd/mm/yyyy'),
--- i want to gent parameter in from of MONTH-YEAR AND WANT TO CONVERT DATE INTO 'THIS FORMAT dd/mm/yyyy' IT GIVES ME ERROR PLEASE GUIDE
to_date ( TO_CHAR (PTP.END_DATE ,'MONTH-YYYY') ,'dd/mm/yyyy'),
ADD_MONTHS((to_date ( TO_CHAR (PTP.END_DATE ,'MONTH-YYYY') ,'dd/mm/yyyy'),-1)
--- i want to gent parameter in from of MONTH-YEAR AND WANT TO CONVERT DATE INTO 'THIS FORMAT dd/mm/yyyy' IT GIVES ME ERROR PLEASE GUIDE
ptp.END_DATE PERRIODS_NAME
from per_time_periods ptp
Regards
Edited by: user10941925 on Nov 28, 2011 12:23 AMHello just check
SQL> select hiredate from emp;
HIREDATE
17-DEC-80
20-FEB-81
22-FEB-81
02-APR-81
28-SEP-81
01-MAY-81
09-JUN-81
09-DEC-82
17-NOV-81
08-SEP-81
12-JAN-83
03-DEC-81
03-DEC-81
23-JAN-82
14 rows selected.
SQL> select to_char(hiredate,'month-year') from emp;
TO_CHAR(HIREDATE,'MONTH-YEAR')
december -nineteen eighty
february -nineteen eighty-one
february -nineteen eighty-one
april -nineteen eighty-one
september-nineteen eighty-one
may -nineteen eighty-one
june -nineteen eighty-one
december -nineteen eighty-two
november -nineteen eighty-one
september-nineteen eighty-one
january -nineteen eighty-three
december -nineteen eighty-one
december -nineteen eighty-one
january -nineteen eighty-two
14 rows selected.
SQL> select to_char(hiredate,'dd/mm/yyyy') from emp;
TO_CHAR(HI
17/12/1980
20/02/1981
22/02/1981
02/04/1981
28/09/1981
01/05/1981
09/06/1981
09/12/1982
17/11/1981
08/09/1981
12/01/1983
03/12/1981
03/12/1981
23/01/1982
14 rows selected.
SQL> -
How to convert date format in VC 7.0 to DD.MM.YYYY
Hi
I am on VC 7.0.
My requirment is to show Current date as a default value for a input field.
I am using date function now() as default value...and it is displaying the current date
08.07.2009 as Jul 08,2009
But my requirment is to display it as 08.07.2009
Please update me how to convert the data format to be displayed as DD.MM.YYYY format
ThanksHi,
Use DSTR method to change date format. Check the below link for details.
http://help.sap.com/saphelp_nw70/helpdata/en/49/032e66f4a4105ee10000000a42189d/frameset.htm
Regards
Basheer -
How to convert date format to MM/DD/YYYY
Hi,
How to convert date format to MM/DD/YYYY.
Thanks,
Senthilhi,
tri with this function module
data :l_date(10) type c
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
DATE_INTERNAL = SY-DATUM
IMPORTING
DATE_EXTERNAL = l_date.
this function module converts date from 20050601 to external format which is specified in user profile
cheers,
sasi -
Convert date format yyyy-mm-dd to yyyymmdd
Hi All,
Could you please tell me how to do the mapping format to Convert date format yyyy-mm-dd to yyyymmdd
or
Please provide any UDF for this conversion.
Thank you .
Regards,
Bharat KumarHI ,
You can easily do that by using the standard datetransformation fuction . in the property of that function put your coming source and desired target format . However once you specify the source format then the source field should always be in thaat format
Regards,
Saurabh -
Convert date format YYYYMMDD to DD.MM.YYYY
hi
i was wondering is there a FM which convert date format YYYYMMDD to DD.MM.YYYY
instead of u know cutting the YYYY and MM and DD and concatement them againHi ,
See this piece of code
Data : w_date type dats value '20080903',
w_date1(10),
Constants : C(1) value '.'.
w_date1 = w_date.
concatenate w_date+6(2) w_date+4(2) w_date+0(4) into w_date1 separated by C.
Write : / w_date1.
With Regards.
Alwasy Learner -
How to convert date format dd.mm.yy into yyyymmdd?
Hello experts,
how to convert date format dd.mm.yy into yyyymmdd?
Thanx
AxelHi
go through these previous threads on similar question
https://forums.sdn.sap.com/click.jspa?searchID=673529&messageID=1763194
Date Conversion in Flat File
converting the DATE(yyyymmdd) into MONTH(yyyymm) format
Date Format Conversion from MM.DD.YYYY to YYYYMMDD
gives clear idea
Reagrds
Kiran
Message was edited by:
ravi kiran naalla -
How to convert date format to ISO8601 in Oracle BPEL
Hi,
I need to convert date format from YYYY/MM/DD 00:00:00 to YYYY-MM-DDThh:mm:ss format in oracle BPEL. Can any of you help me out. Thanks in advance.Hi Anuj,
I have use the below mentioned code to convert the date format.
<db:P_X_DATE_FROM>
<xsl:value-of select='concat(substring(../VALUE,1.0,4.0),"-",substring(../VALUE,6.0,2.0),"-",substring(../VALUE,9.0,2.0),"T",substring(../VALUE,12.0,8.0))'/>
</db:P_X_DATE_FROM>
Thanks & Regards,
Jyotirmoy. -
Need help in converting date format
Hi,
Need help in converting date format from 'DD-MON-YYYY' to 'YYYY-MM-DD' in an .rtf template as I believe xml publisher supports the date format as 'YYYY-MM-DD' only.
Thanks,
Raj.I got the same problem, anyone know how to solve this problem? I allready found some date functions on http://blogs.oracle.com/xmlpublisher/2008/09/date_functions.html . I also tried <?xdoxslt:month_name(xdoxslt:get_month(xdofx:substr(NEED_BY_DATE, 4,3)), $_XDOLOCALE), 0, 'nl-NL')?>, but then it returns a namespace error (Caused by: oracle.xdo.parser.v2.XPathException: Namespace prefix 'xdofx' used but not declared.). Anyone know how to fix this?
Edited by: user11165753 on 7-dec-2009 23:50 -
Is there any function module to convert date format?
Is there any function module to convert date format from mm/dd/yyyy to dd.mm.yyyy or sy-datum?
Hi,
wirte statement converts any date fomat in system date fromat
WRITE w_DateTO w_date_sys.
Regards,
Sriram -
How to convert date format into sap standard format?
Hi All,
In SAPUI5 screen i have one simple form in form i have date field which is format (MM/DD/YYYY). but i am getting POST error while inserting the data in to sap table.
I want convert date format in sap format (YYYY/MM/DD).
One more issue, when i am fetching the data from sap table,but the date display with time and time zone.
eg. Sat Aug 02 2014 05:30:00 GMT+0530 (India Standard Time)
I want to display only date.
Thanks,
Prashant.Now i am using <DatePicker id="Emp_fsdate" displayFormat="yyyy-MM-dd"/>
I checked in console, but date is display like mm/dd/yy
In my controller.js file i have written code
OData.request
requestUri: "http:sap/opu/odata/sap/ZSERVICE_FINAL_SRV/es_sodata",
method: "GET",
headers:
"X-Requested-With": "XMLHttpRequest",
"Content-Type": "application/atom+xml",
"DataServiceVersion": "2.0",
"X-CSRF-Token":"Fetch"
function (data, response){
var header_xcsrf_token = response.headers['x-csrf-token'];
OData.request
requestUri:
"http://sap/opu/odata/sap/ZSERVICE_FINAL_SRV/es_sodata",
method: "POST",
headers:
"X-Requested-With": "XMLHttpRequest",
"Content-Type": "application/atom+xml",
"DataServiceVersion": "2.0",
"Accept": "application/atom+xml,application/atomsvc+xml,application/xml",
"X-CSRF-Token": header_xcsrf_token
data:
Empid:Emp_id,
Empname:Emp_name,
Start_Date:Emp_sdate,
// End_Date:Emp_edate,
Status:Emp_status,
City:Emp_city,
Location:Emp_location,
and in my CREATE_ENTITY method
method ES_SODATA_CREATE_ENTITY.
DATA: ls_request_input_data TYPE zcl_zservice_final_mpc=>ts_et_sodata,
ls_userinfo TYPE zsodata.
DATA ls_temp TYPE sy-datum.
* Read Request Data
io_data_provider->read_entry_data( IMPORTING es_data = ls_request_input_data ).
* Fill workarea to be inserted
ls_userinfo-Empid = ls_request_input_data-Empid.
ls_userinfo-Empname = ls_request_input_data-Empname.
ls_userinfo-Start_Date = ls_request_input_data-Start_Date.
ls_userinfo-End_Date = ls_request_input_data-End_Date.
ls_userinfo-Status = ls_request_input_data-Status.
ls_userinfo-City = ls_request_input_data-City.
ls_userinfo-Location = ls_request_input_data-Location.
* Insert Data in table ZUSERINFO
INSERT zsodata FROM ls_userinfo.
IF sy-subrc = 0.
er_entity = ls_request_input_data. "Fill Exporting parameter ER_ENTITY
ENDIF.
endmethod.
But still i am getting an error
POST http://sap/opu/odata/sap/ZSERVICE_FINAL_SRV/es_sodata 500 (Internal Server Error)
I am able to insert all field except date field. How to insert date field in sap table. -
How to convert date format(mm/dd/yy) into dd-mm-yy
I want to convert date format(mm/dd/yy) into dd-mm-yy
like 12/23/06 into 23-sep-06hey, you can use SimpleDateFormat to format your date. this is sample code, maybe could help you.
class dateFormat
public static void main(String[] args)
Date now = new Date();
System.out.println("Before format : "+now);
SimpleDateFormat sdf = new SimpleDateFormat( "dd-MM-yy" );//Change your date format in here.
String display = sdf.format(now);
System.out.println("After format : "+display);
}If you already understand about my sample code, i think it's easy to make your own date format. Just modified few line of my code. -
How to convert Date format into day in ssrs reports?
Hi
How to convert date format into day?
10/01/2010 as like Monday like that?=weekdayname(datepart("w",Fields!mydate.Value))
-Vaibhav Chaudhari -
Date format in flat file is MM/DD/YYYY
I want to to change date format in flat file from MM/DD/YYYY to in info cube YYYYMMDD.
What is the step by step procedure to do this.Hi,
The date format should be YYYYMMDD in flat file.
IF the date format is not the above mentioned way, then you can change setting.
Going to System in Menu
System->User Profile->Own data.
Under Owndata you can change the date format to your requirement.
Check the below link also for detain info of coding:
Mandatory for Date field
regards
shoba -
Function module to convert date format from yyyymmdd to mmddyyyy format
function module to convert date format from yyyymmdd to mmddyyyy format
Hi Rajitha,
Do like this
Data: Var1 type sy-datum,
var2(8) type c.
var1 = sy-datum.
Concatanate var1+4(2) var1+6(2) var1+0(4) into var2.
write var2.
Reward Points if this helps,
Satish -
Question about get web service result in actionscript and convert data format
Hi, All
I have question about how to get dataset from web services
and put it in tree structure. I have 2 questions about this:
1, How can I get data correctly in actionscript?
I have no problem to get data by
<mx:ArrayCollection id="acFolder"
source="{mx.utils.ArrayUtil.toArray(MyGServices.getFolder.lastResult)}"
/>
And display in datagrid.
But when I try to use
public function
handleFolderContents(event:mx.rpc.events.ResultEvent):void{
arData=mx.utils.ArrayUtil.toArray(event.result);
acData=new ArrayCollection(arData);
input.text=acData.getItemAt(0).id;
Seems I can’t get data, it always say:
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
2, how to convert data format
I get data from web service and want to convert it to tree
structure, as mention below:
I get:
<Array>
<id>111</id>
<Name>Production1</Name>
</Array>
<Array>
<id>222</id>
<Name>Production2</Name>
</Array>
Convert to:
<mx:XMLList id="treeData">
<node>
<node label="Production1" data="111">
<node label="Production2" data="222"/>
</node>
</node>
</mx:XMLList>
Please help me.
Thanks.First, don't specify the package path in the argument
declaration. Instead import the event object:
import mx.rpc.events.ResultEvent;
The docs state this emphatically.
Second, try "lastResult", in place of "result":
arData=mx.utils.ArrayUtil.toArray(event.lastResult); // I am
not positive about this. I maybe recall reading that result was ok
for the event object, but maybe not.
Finally, why do you want to convert the xml? You certainly
could, but it would be a manual process, recursively reading the
existing xml nodes and building the new structure, but again, why?
Just use a labelFunction if necessary to display the nodes as
you wish.
Tracy
Maybe you are looking for
-
Snow Leopard has ruined my browsers
I upgraded from Leopard to Snow Leopard a few days ago, and ever since my internet browsing has been crippled. I use Google Chrome but the following problems persist across all browsers: - Websites randomly won't load, I'll just get the 'Oops! Google
-
Importing from "Windows Photo Gallery"
New User, failed to find an answer after 30 minutes of searching the discussion groups. So here goes: Just got my first Mac and I have successfully imported 18,000 photos which I managed on my windows vista box using "Windows Photo Gallery". The prob
-
DEAR FRIENDS, HOW TO CHANGE THE PRICE IN A SALES ORDER . THE SALES ORDER QUANTITY IS 5. ONE QUANTITY IS DELIVERED. I NEED TO CHANGE THE PRICE FOR THE SECOND QUANTITY. CAN ANY ONE GUIDE ME THANKS MANOJ
-
How to find and replace any string between " "
Hi everyone, Here my sample String szTest; szTest = "Yellow banana"; szTest = "Blue monkey"; szTest = "Red mango"; szTest is only needed when it's in testing progress. Now I want to put all of that in the /*comment*/ so the released program won't run
-
Do i need a DBA to sell ebooks?
Q. Do i need a Doing Business As papers for a Federal Tax number or can i use my Federal Tax ID number? Ps. Bought the mac. My PC is getting rebuilt. Im almost there. Thanks to those of you who have helped out on getting started.