Convert Number to the date format
Hello,
In CRM, i want to input the number as a parameter and convert the number into Date format. Is there any function module in CRM which accepts the number and gives the date as output .
Example.
suppose input given is 734484
output : 12-12-2011 .
The number 734484 reflects the total number of days from '0000' to 12-12-2011
Regards,
Rohini
920575 wrote:
I have a sql like this:
select to_date('MAR','Mon', 'NLS_DATE_LANGUAGE=American') m from dualI want to display '3' instead of showing MAR...
I tried to use to_char(date,'MM') but the result will return '03'.
I would like to have the output exactly equal to 3.3 (without single-quotes) is a NUMBER. It is exactly equal to the NUMBER 03.
'3' is a string. It is not equalt to the string '03'.
Do you want a NUMBER or a string?
If you want the 1-character string '3', then use 'fmMM' instead of 'MM'.
select TO_CHAR ( to_date ('MAR', 'Mon', 'NLS_DATE_LANGUAGE=American')
, 'FMMM'
) AS m
from dualTO_CHAR sometimes adds padding (sometimes spaces, sometimes '0's) to make elements a constant width. For example, some months need 2 characters for the 'MM' format, so TO_CHAR, by default, left-pads with '0's to make all months 2 characters, whether they need 2 characters or not. Using 'FM' (case insensitive) IN the format string changes whether or not this kind of padding will be added.
You could also use LTRIM to remove the leading '0's in this case, but why remove them when it's easier not to generate them in the first place?
Similar Messages
-
How can i convert a the date format 'm/d/yyyy hh:mi:ss AM' to 'MM/DD/YYYY HH:MI:SS AM' in Oracle
I have a query
select UPPER(t.val_10) "TYPE", count(val_3) "Number of Transfers"
from table1 t
where t.is_active = 1
and t.val_4 = 'INBOUND'
and to_date(to_date(val_5,'MM/DD/YYYY HH:MI:SS AM'), 'DD/MM/YY') between to_date(to_date('01/08/2008 00:00:00','DD/MM/YYYY HH24:MI:SS'), 'DD/MM/YY') and add_months(to_date(to_date('01/08/2008 00:00:00','DD/MM/YYYY HH24:MI:SS'), 'DD/MM/YY'),1)
group by UPPER(t.val_10)
order by UPPER(t.val_10)
I get the error [ORA-01861: literal does not match format string which i think is because
val_5 has the values in the following format:
8/29/2008 6:31:10 PM
Does anyone have an answer?
Thanks in advance
Edited by: user2360027 on 26-Mar-2009 03:50first off, you've got to_date(to_date(...)) - NEVER do this - you're forcing an implicit to_char which can cause all sorts of problems!
What is the data type of your column val_5? If it's DATE then your query is simply:
select UPPER(t.val_10) "TYPE",
count(val_3) "Number of Transfers"
from table1 t
where t.is_active = 1
and t.val_4 = 'INBOUND'
and val_5 between to_date('01/08/2008','DD/MM/YYYY') and add_months(to_date('01/08/2008','DD/MM/YYYY') ,1)
group by UPPER(t.val_10)
order by UPPER(t.val_10)If it's a varchar2 (why, oh why, oh why, ...?!), then your query should be:
select UPPER(t.val_10) "TYPE",
count(val_3) "Number of Transfers"
from table1 t
where t.is_active = 1
and t.val_4 = 'INBOUND'
and to_date(val_5, 'mm/dd/yyyy hh:mi:ss AM') between to_date('01/08/2008','DD/MM/YYYY') and add_months(to_date('01/08/2008','DD/MM/YYYY') ,1)
group by UPPER(t.val_10)
order by UPPER(t.val_10)Remember that dates in DATE format are stored in an internal Oracle format - in order for you to tell Oracle that your string is a date, you need to use to_date. When you want to retrieve a date, you need to use to_char to put it into the format you want to see it in.
Remember also that your nls_date_format defines the default format that you'll see a date, which is what is used in the implicit conversion that oracle does when you select a date:
SQL> alter session set nls_date_format='dd/mm/yyyy hh24:mi:ss';
Session altered.
SQL> select sysdate from dual;
SYSDATE
26/03/2009 11:01:53
1 row selected.
SQL> alter session set nls_date_format='mm/dd/yy hh12:mi:ss AM';
Session altered.
SQL> select sysdate from dual;
SYSDATE
03/26/09 11:02:24 AM
1 row selected.It doesn't make sense to convert something that's already in a DATE format into a DATE format - in order to do that, oracle has to first change the date into a string, and it does that by using the nls_date_format parameter setting - if you're working with dates-in-strings that are in a different format, then all sorts of problems arise, as you have found out! -
Is there any function module to convert the date format
Dear ABAPers,
Is there any function module to convert the date format from dd.mm.yyyy to dd-mmm-yyyy.
I want to convert the date format from dd.mm.yyy to dd.mmm.yyy Eg.from 10.03.2008 to 10-mar-2009.
Thanks & Regards,
Ashok.hi,
create custom function module or copy the below code in the report ..and use it
the out put for below is :----Convert a DATE field into a full format date eg. March 23, 2000
FUNCTION Z_CONVERT_DATE_INTO_FULL_DATE.
""Local interface:
*" IMPORTING
*" VALUE(DATE) LIKE SY-DATUM
*" EXPORTING
*" VALUE(FORMATTED_DATE)
*" EXCEPTIONS
*" INVALID_DATE
TABLES: TTDTG.
DATA: BEGIN OF T_DATE,
YYYY(4) TYPE C,
MM(2) TYPE C,
DD(2) TYPE C,
END OF T_DATE.
DATA: DAY(3) TYPE N.
DATA: VARNAME LIKE TTDTG-VARNAME.
IF DATE IS INITIAL.
CLEAR FORMATTED_DATE.
EXIT.
ENDIF.
check document date format
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
DATE = DATE
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1.
IF SY-SUBRC NE 0.
RAISE INVALID_DATE.
ENDIF.
MOVE DATE TO T_DATE.
CONCATENATE '%%SAPSCRIPT_MMM_' T_DATE-MM INTO VARNAME.
SELECT SINGLE * FROM TTDTG WHERE SPRAS = 'EN' AND VARNAME = VARNAME.
WRITE T_DATE-DD TO DAY.
CONCATENATE DAY ',' INTO DAY.
CONCATENATE TTDTG-VARVALUE DAY T_DATE-YYYY INTO FORMATTED_DATE
SEPARATED BY SPACE.
ENDFUNCTION.
the output is :--Convert a DATE field into a full format date eg. March 23, 2000
Regards,
Prabhudas -
Why cant I have the date format like this: 1/2/07, it converts to Jan 2
Why cant I have the date format like this: 1/2/07, it converts to Jan 2, 2007
I want to keep it like that because, I transported a huge spreadsheet from my PC, and it has like this: 1/1/07, and there is way to many, to go back and change. Please help. Thank you.Hello
Welcome to the club.
The response seems to be simple.
Those who wrote the Help are not those who wrote the PDF User's Guide which are not those who coded the application.
As on this forum you will met only users trying to help other users, no one would be able to tell you if what we got is a bug or a design flaw.
Like many of us,
*Go to "Provide Numbers Feedback" in the "Numbers" menu*, describe what you wish: a way to define the default format used as Automatic date/time.
Then, cross your fingers, and wait for iWork'09
Yvan KOENIG (from FRANCE mardi 15 janvier 2008 15:10:17) -
How can I change the date format in Reminders and in Notes?
How can I change the date format in both Notes and Reminders? Preference on Imac and Settings in IOS do not allow me to change the format in those 2 apps.
I Like to see 10oct rather than 10/10, as an example.pierre
I do not have Mavericks or iOS - but the first thing I would do is reset the defaults - I'll use Mavericks as an example
From If the wrong date or time is displayed in some apps on your Mac - Apple Support
OS X Yosemite and Mavericks
Open System Preferences.
From the View menu, choose Language & Region.
Click the Advanced button.
Click the Dates tab.
Click the Restore Defaults button.
Click the Times tab.
Click the Restore Defaults button.
Click OK.
Quit the app where you were seeing incorrect dates or times displayed.
Open the app again, and verify that the dates and times are now displayed correctly.
Then customize to taste - OS X Mavericks: Customize formats to display dates, times, and more
OS X Mavericks: Customize formats to display dates, times, and more
Change the language and formats used to display dates, times, numbers, and currencies in Finder windows, Mail, and other apps. For example, if the region for your Mac is set to United States, but the format language is set to French, then dates in Finder windows and email messages appear in French.
Choose Apple menu > System Preferences, then click Language & Region.
Choose a geographic region from the Region pop-up menu, to use the region’s date, time, number, and currency formats.
To customize the formats or change the language used to display them, click Advanced, then set options.
In the General pane, you can choose the language to use for showing dates, times, and numbers, and set formats for numbers, currency, and measurements.
In the Dates and Times panes, you can type in the Short, Medium, Long, and Full fields, and rearrange or delete elements. You can also drag new elements, such as Quarter or Milliseconds, into the fields.
When you’re done customizing formats, click OK.
The region name in Language & Region preferences now includes “Custom” to indicate you customized formats.
To undo all of your changes for a region, choose the region again from the Region pop-up menu. To undo your changes only to advanced options, click Advanced, click the pane where you want to undo your changes, then click Restore Defaults.
To change how time is shown in the menu bar, select the “Time format” checkbox in Language & Region preferences, or select the option in Date & Time preferences.
Here's the result AppleScript i use to grab the " 'Short Date' ' + ' 'Short Time' " to paste into download filenames - works good until I try to post it here - the colon " : " is a no-no but is fine in the Finder
Looks like iOS Settings are a bit less robust
- Date/Time formats are displayed according to 'tradition' of your region > http://help.apple.com/ipad/8/#/iPad245ed123
buenos tardes
ÇÇÇ -
Problem with the Date format and sending it to R/3
Hi all,
I have an Adaptive RFC application which fetches the data from the R/3 and displays the Employee's Personal Data.
I am using a ZFM which is customised as per the requirement from the Standard BAPI_EMPLOYEE_GETDATA.
Now the Problem i am facing is Date is default and Optional Parameter in RFC.
If i execute the RFC in R/3 without Date it is not filling the Internal Tables. And if i pass the Date it is filling the Internal Table and fetches the Records.
So in WD application i am inputing Employee FirstName, LastName or the Employee ID.
User can give any of the above input or combination of FirstName and LastName Or only the Employee ID.
Now the Main Problem is of Date which is of type Date.
I have also tried the SimpleDateFormat Class, but i am not able to achieve the result.
I have also seen the Links and threads on SDN, but unable to solve the problem.
So pls help me out asap.
Thanks & Regards,
Dhruv ShahHi ,
By default , RFC accept date format of SQL date (yyyy-mm-dd) . If you are using a date picker from WD, it directly set the date in SQL date format. Incase if you are trying to pass date to RFC in some other way you have to convert that into SQL date format before passing.
if you are passing String date of format dd-mm-yyyy , you try this method to convert that to SQL date and pass to your RFC.
public java.sql.Date sqlDateConvert( String date) {
//@@begin sqlDateConvert()
java.sql.Date dateObj=null;
try{
StringTokenizer tempStringTokenizer = new StringTokenizer(""+date,"-"); int dd=Integer.parseInt(tempStringTokenizer.nextToken().trim());
int mm=Integer.parseInt(tempStringTokenizer.nextToken().trim());
mm=mm-1;
int yyyy=Integer.parseInt(tempStringTokenizer.nextToken().trim());
Calendar cal =Calendar.getInstance();
cal.set(yyyy,mm,dd);
dateObj = new java.sql.Date( cal.getTime().getTime());
}catch(Exception e)
return dateObj;
Hope this will help you. -
How do I stop the date format from changing to US format?
I have an excel doc that I've converted to pdf. In the process the date format changed to mm/dd/yyyy. How do I stop this from happening?
Hello,
In a earlier attempt I marked all the date entries and labeled them as such (see screenshot of my German Excel):
After that I converted the file by help of Excel(!) and I got this pdf file, which had all the entries formatted as produced in Excel before.
Hans-Günter -
HT3345 Importing from xls problems with the date format (mixed european format)
Hi.
I made some spreadsheets with Neo Office and saved them in xls format. So I can import them in numbers, doing so in OpenOffice, LibreOffice or even the worst in Mircosoft Office on a PC works just fine. But importing them with Numbers 2.0.4 it just don't work.
I have Mac OSX 10.5.8 and a PowerPC G4 1,67 GHz.
The date format in all other programs is " 21.05.2011" and numbers creates "21/05/2011" out of it. Although my international setting is set to 23.05.2012. It defines the cells as my own format and takes than the totally wrong format.
Does anyone know how to solve this problem, or how to change all the weird own formats in my international setting, which would be correct.
Best regards.Hi Franklin,
I used to have similar problem with date too. To make my forms and reports work for all date, I used to send the parameter from forms to the report in text format. In the report, I grab that parameter as "Text Format" (I mean the parameter created in Oracle Reports was really as Character in datatype property) then I manipulate them in my SQL to convert that "date" into real date using TO_DATE function. Usually I use DD-MM-YYYY as my date format.
Hope this help.
Regards,
Franko Lioe
Hello friends at www.oracle.com,
when I sent some informations to Reports, one of these informations was a date field. Here, the format mask may vary from one computer to another - some computers here are using american date format; however, my computer was using brazilian date format.
The fact is that I was sending date information to Reports using the mask dd/mm/yyyy, and Reports (in the computer that uses american date format) couldn't recognize it, stating that I was sending an invalid month. So I had to change my date information to dd-mon-yyyy and Reports could run in the other computer, but doesn't run here anymore - fact that obligated me to change my date format to american format.
Is there any way for me to use a date format mask that's valid to all computers here? If other computers - with other format masks - meet the same problem, the use of this program may become something very complicated.
Thanks for all answers,
Franklin Gongalves Jr.
[email protected] -
By default the component <af:selectInputDate> shows the client machine's date format when the image is clicked. How can we change the date format of the same irrespective of the client machine's date format
<af:selectInputDate accessKey="D" label="From Date:" readOnly="yes"
value="#{EvalBean.fromDate}"/>Also
1. How can we validate the date range also?
Eg: From Date should not be greater than To Date
2. Should not allow the user to select Date (From Date or To Date) greater than today's date.
UdayIf you want to do it at the page level you can use the
<f:convertDateTime pattern="dd/MM/yyyy"/> jsf converter inside your date field
and also the af:validateDateTimeRange tag to limit the date range.
If you don't want to do it in every single page and you are using the ADF Model layer for binding you can define a control hint on your date field that specify a format mask. You can also add a method validator to your date field to verify the range. -
How can we give the Data Format (File Type ) in Runtime
Hi all,
How can we give the Data Format (File Type ) in Runtime for the following method,
cl_gui_frontend_services=>gui_download.
Thanks in advance
SriThere is a filetype parameter which you can set
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
* BIN_FILESIZE =
filename =
* FILETYPE = 'ASC'
* APPEND = SPACE
* WRITE_FIELD_SEPARATOR = SPACE
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = SPACE
* WRITE_LF = 'X'
* COL_SELECT = SPACE
* COL_SELECT_MASK = SPACE
* DAT_MODE = SPACE
* CONFIRM_OVERWRITE = SPACE
* NO_AUTH_CHECK = SPACE
* CODEPAGE = SPACE
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = SPACE
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* IMPORTING
* FILELENGTH =
changing
data_tab =
* EXCEPTIONS
* FILE_WRITE_ERROR = 1
* NO_BATCH = 2
* GUI_REFUSE_FILETRANSFER = 3
* INVALID_TYPE = 4
* NO_AUTHORITY = 5
* UNKNOWN_ERROR = 6
* HEADER_NOT_ALLOWED = 7
* SEPARATOR_NOT_ALLOWED = 8
* FILESIZE_NOT_ALLOWED = 9
* HEADER_TOO_LONG = 10
* DP_ERROR_CREATE = 11
* DP_ERROR_SEND = 12
* DP_ERROR_WRITE = 13
* UNKNOWN_DP_ERROR = 14
* ACCESS_DENIED = 15
* DP_OUT_OF_MEMORY = 16
* DISK_FULL = 17
* DP_TIMEOUT = 18
* FILE_NOT_FOUND = 19
* DATAPROVIDER_EXCEPTION = 20
* CONTROL_FLUSH_ERROR = 21
* NOT_SUPPORTED_BY_GUI = 22
* ERROR_NO_GUI = 23
* others = 24 -
How to change the date format?
Hi,
I need to display the data format as(YYYY-MM-DD). But now it displays(2009-1-9)
Here is my code snippet which i used to display the data format as(2009-1-9)
*<INPUT TYPE=TEXT NAME="date_submitted" MAXLENGTH=20 SIZE=10 VALUE="" onBlur= "return dateSubmitted()"> (YYYY-MM-DD)*
*<SCRIPT LANGUAGE="javascript">*
dateSubmitted()
*</SCRIPT>*
function dateSubmitted()
if (document.pgUpdate.date_submitted.value == "")
date = new Date();
month = date.getMonth() + 1
document.pgUpdate.date_submitted.value =
date.getYear() + "-" + month + "-" + date.getDate();
return true;
Can anybody help me how to change the date format?
Thanks in advance!prit123 wrote:
use SimpleDateFormat class. The code is :He posted a Javascript related question, not a Java related question.
Please use forums devoted to Javascript. You're here at a Java/JSP forum.
There are JS forums at webdeveloper.com and dynamicdrive.com. Good luck.
String formatPattern = "yyyy-mm-dd";
SimpleDateFormat sdf = new SimpleDateFormat(formatPattern);
sdf.format(yourdate);yyyy-mm-dd denotes year-minutes-days. Please go read the SimpleDateFormat API as well. -
Changing the Date format in iCal
Is there any way to change the date format from American (MM/DD/YY) to European (DD/MM/YY) in iCal?
Thanks in advance.As far as I'm aware, it should respect what you specify in the Formats tab of the International pane in System Preferences.
-
Error with the data format in the TXT file, sending as an Email attachment
Hi all,
I have an problem in the data formating in the TXT file while sending as an attachment via an email by using the FM "SO_DOCUMENT_SEND_API1".
For eg:
The data in the TXT file is looking like as follows:
0 0 0 0 2 L O U D S P E A K R O T H E R 3 8 W h i t e 0 0
0031 L O U D S P E A K R O T H E R 3 8 Black 0 000
38 L O U D S P E A K R O T H E R 3 8 Brown 0 00040
L O U D S P E A K R O T H E R 3 8 Brown 0 00042
and so on
But it should come as :
0 0 0 0 2 L O U D S P E A K R O T H E R 3 8 W h i t e
0 0 0031 L O U D S P E A K R O T H E R 3 8 Black
0 00038 L O U D S P E A K R O T H E R 3 8 Brown
0 00040 L O U D S P E A K R O T H E R 3 8 Brown
All the internal tables are correctly filled.
The code is as follows:
gwa_objtxt = 'Please find attached DATA EXTRACT Sheet'.
append gwa_objtxt to git_objtxt.
describe table git_objtxt lines gv_cnt.
clear git_doc_data.
read table git_objtxt index gv_cnt.
git_doc_data-doc_size = ( gv_cnt - 1 ) * 255 + strlen( gwa_objtxt ).
git_doc_data-obj_langu = sy-langu.
git_doc_data-obj_descr = lv_mtitle.
append git_doc_data.
clear git_packing_list.
refresh git_packing_list.
git_packing_list-transf_bin = space.
git_packing_list-head_start = 1.
git_packing_list-head_num = 0.
git_packing_list-body_start = 1.
git_packing_list-body_num = gv_cnt.
git_packing_list-doc_type = 'RAW'.
append git_packing_list.
Clear : gv_cnt.
Describe table git_objbin lines gv_cnt.
git_packing_list-transf_bin = 'X'.
git_packing_list-head_start = 1.
git_packing_list-head_num = 1.
git_packing_list-body_start = 1.
git_packing_list-body_num = gv_cnt.
git_packing_list-doc_type = 'TXT'.
git_packing_list-obj_descr = 'ATTACH.TXT'.
git_packing_list-obj_name = 'book'.
git_packing_list-doc_size = gv_cnt * 255.
APPEND git_packing_list.
clear git_receivers.
refresh git_receivers.
git_receivers-receiver = gv_eid.
git_receivers-rec_type = 'U'.
append git_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = git_doc_data
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = git_packing_list
CONTENTS_BIN = git_objbin
CONTENTS_TXT = git_objtxt
RECEIVERS = git_receivers
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.please give the code of
contents bin = git_objbin " how this is getting populated.
0 0 0 0 2 L O U D S P E A K R O T H E R 3 8 W h i t e <b>0 0</b>
0031 L O U D S P E A K R O T H E R 3 8 Black
0 000
38
from this im not able to understand is this over population or concatenation problem
y dont u make a append to the final table
like
data : begin of itxt occurs 0, ,
s1(132) type c ,
end of itxt.
loop at itab.
itxt-s1+0(4) = itab-f1.
itxt-s1+4(6) = itab-f2.
itxt-s1+10(8) = itab-f3.
itxts1+18(4) = itab-f4.
append itxt.
clear itxt.
endloop.
exchange this to the contents bin of hte Fm .
regards,
vijay.
can u please mail the text file and the expected o/p to my mail id [email protected] so that i can see the same from the data provided i m not able to check the result properly . -
How to define the date format for this date string
2006-11-13 00:00:00.0
How to define the date format in control file for sqlldr. "yyyy-mm-dd hh24:mi:ss" or "yyyy-mm-dd hh24:mi:ss.FF1" does not work
thanks,SQL> desc t
Name Null? Type
TS TIMESTAMP(6)
SQL> !cat t.ctl
load data
into table t
truncate
(ts timestamp "YYYY-MM-DD HH24:MI:SS.FF1")
SQL> !cat t.dat
2006-11-13 00:00:00.0
SQL> !sqlldr userid=scott/tiger control=t.ctl data=t.dat log=t.log
SQL*Loader: Release 10.2.0.3.0 - Production on Fri Sep 7 11:19:28 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 1
SQL> select * from t;
TS
13-NOV-06 12.00.00.000000 AMBest regards
Maxim -
How to make the date format in ipod the same as in itunes?
When I look at my podcasts in itunes, the dates come up as dd/mm/yyyy (which is correct), however, when I look at my podcasts on the ipod, the date comes up as mm/dd, which is very confusing.
I cannot figure out how to make it so that the date format is the same.When I look at my podcasts in itunes, the dates come up as dd/mm/yyyy (which is correct), however, when I look at my podcasts on the ipod, the date comes up as mm/dd, which is very confusing.
I cannot figure out how to make it so that the date format is the same.
Maybe you are looking for
-
I'm trying to hook up my macbook pro to my new LG tv, I have the desktop screen on my tv (I was told I had to open a 2nd desktop and then drag my dvd screen into it, it still doesn't work.
-
For vendor e-mail address, I cannot find the field in table LFA1, can anyone tell me which table this information is held in? In XK03 all our vendors have the e-mail address field populated Thanks Prakash
-
XI impoartance in MDM and SAP core?
Hi Friends, I am new to the NW competency,Just working in XI. can any one explain the use and importance of XI in SAP and MDM. Thanks un advance. regards Mc
-
is it possible to copy an accordian menu onto a new page, i would just save it as a new page but I want to change the language of the menu and therefor the template for the other page is completely different. So I would like to copy the english menu
-
Enable Smart Views or Smart Folders in Reminders
I used Reminders to keep track of all my tasks across Mac OS X and my iOS devices. To manage the large number of reminders I have in there, it would be great to have a new feature for "Smart Views" or "Smart Folders" that allow you to see those tasks