Formating string to date format in vc

hai,
function module in production return a date in type of char10. now i need to convert into proper data format.
can any one help me.

data: l_date type datum
      , l_d(10)
l_date = sy-datum.
write l_date to l_d. -> This statement will convert into user date format
write:/ l_d.  
...Naddy

Similar Messages

  • I want convert string to date format in Oracle

    Dear All
    I want convert string to date format in Oracle,Format is given below
    'Friday, 02 March 2012 2:44 PM' to '02/03/2012 2:44 PM'

    >
    Hi Parwez,
    I want convert string to date format in Oracle,Format is given below
    'Friday, 02 March 2012 2:44 PM' to '02/03/2012 2:44 PM'SELECT TO_DATE('Friday, 02 March 2012 2:44 P.M.', 'DAY, DD MONTH YYYY HH:MI A.M.') from dual;
    As well as what the other poster suggested, look here: http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements004.htm#i34924
    HTH,
    Paul...

  • How to convert a String to Date format?

    the user enter a date in string format and the date is save in the database.
    The problem i am facing is i want to change from String to Date format.
    Here is my codes:
            public boolean insertData() throws Exception {
            boolean validFlag = false;
            DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
            Date d = df.parse("05/18/05");
            String MY_DATE_FORMAT = "yyyy-MM-dd";
            String jobAdvertisementDate = new SimpleDateFormat(MY_DATE_FORMAT).format(d);
            String sql = "INSERT INTO companyjob (CompanyID,JobID, JobAdvertisementDate ) " +
                    " VALUES ('" + companyID + "','" + jobID + "', '" + jobAdvertisementDate + "')";
            System.out.println(sql);
            validFlag = executeSQL(sql);
            return validFlag;
        }The date is save under jobAdvertisementDate.
    My netbeans shows an error. There's a red line under DateFormat and parse inside my codes.
    PLease help me. Reply asap!!

    BebeGirl wrote:
    My netbeans shows an error. There's a red line under DateFormat and parse inside my codes.
    Red Line? Sounds ominous. I wonder what it means.
    So...what does the error say?

  • String to DATS format conversion in XI.

    Hello Experts,
    I am using Powerbuilder system to get my Legacy data.In Powerbuilder Date needs to be supplied in STRING format.So I am giving String Format (dd-mmm-yyyy).
    However, at SAP end, Date needs to be in DATS format (Standard SAP yyyymmdd) .
    In Message Mapping I have given I/P structure as String and O/P structure as DATS format. When I test mapping in XI, it gives me Parseable error.
    Can anybody tell me, is there any way in XI to convert from String to DATS format so that I do not get Parseable error.
    Please Help!!!!

    Lokesh,
    With XI there is a date transformation function under date category there you need to provide source date format and target date format..
    I have used the same for fetching the data from oracle..and posting into SAP..it works fine..
    Try this ..this will solve ur problem....you just need to see what is the exact date format used by powerbuilder internally...
    Regards,

  • String to DATS format Conversion

    Hello Experts,
    I am using Powerbuilder system to get my Legacy data.In Powerbuilder Date needs to be supplied in STRING format.So I am giving String Format (dd-mmm-yyyy).
    However, at SAP end, Date needs to be in DATS format (Standard SAP yyyymmdd) .
    In Message Mapping I have given I/P structure as String and O/P structure as DATS format. When I test mapping in XI, it gives me Parseable error.
    Can anybody tell me, is there any way in XI to convert from String to DATS format so that I do not get Parseable error.
    Please Help!!!!

    Lokesh,
    With XI there is a date transformation function under date category there you need to provide source date format and target date format..
    I have used the same for fetching the data from oracle..and posting into SAP..it works fine..
    Try this ..this will solve ur problem....you just need to see what is the exact date format used by powerbuilder internally...
    Regards,

  • (RR FORMAT) ORACLE의  2000년대 DATE FORMAT

    제품 : SQL*PLUS
    작성날짜 : 1997-04-23
    (RR FORMAT) ORACLE의 2000년대 DATE FORMAT
    ==========================================
    이 문서는 단지 정보 제공을 목적으로 하며 여기에 있는 내용은 통보 없이 변경될
    수 있습니다. 오라클은 이 문서에 오류가 없다는 것을 보증하지 않으며, 특정 목
    적에 부합하거나 혹은 상업성에 대한 묵시적인 보증과 조건 -구두적으로 표현되었
    거나 법적으로 함축되었거나- 을 포함하는 어떠한 보장도 제공하지 않습니다. 오라
    클은 본 문서와 관련하여 어떠한 법률적 책임도 지지 않으며, 직접 또는 간접적으
    로 어떠한 계약적 의무도 형성되지 않습니다. 본 문서는 오라클의 사전 서면 동의
    없이 어떠한 목적으로도 전자적으로나 기계적으로 재작성되거나 다른 형태로 변경
    될 수 없습니다.
    ORACLE 7은 세기의 전환에 대해 'RR' 이라는 새로운 DATE FORMAT을 제공한다.
    'RR' 은 DATE FORMAT의 마지막 2 DIGITS에 다른 세기에 대한 DATE값을 저장한다는
    것을 제외하고는 'YY' FORMAT과 유사하다.
    다음은 사용자가 지정하는 YEAR를 현재의 YEAR를 기반으로 하여,
    'RR' FORMAT이 RETURN하는 DATE(세기)를 나타낸 것이다.
    현재 YEAR의 지정된 YEAR의 'RR' FORMAT결과
    마지막 2 DIGIT     마지막 2 DIGIT
    0 - 49     0 - 49     현재 세기
    50 - 99      0 - 49 다음 세기
    0 - 49      50 - 99     이전 세기
    50 - 99     50 - 99     현재 세기
    예를 들면, 현재가 1993년이면, 50에서 90사이의 년도는 20세기에 포함되고,
    0에서 49사이의 년도는 21세기에 포함된다. 마찬가지로 현재가 2001년이면
    50에서 90사이의 년도는 20세기에 포함되고, 0에서 49사이의 년도는 21세기에
    포함된다.
    다음은 'RR'사용에 대한 예이다.
    이와 같이 RR type을 사용하여 모든 application을 수정하기 곤란할 때에는
    환경변수의 nls_date_format을 변경하여도 된다.
    단, nls_date_format은 이후에 다른 사용자에 의해 변경되어질 수도 있으므로
    application을 수정하는 것이 안전하다.
    SQL> INSERT INTO EMP(empno, deptno, hiredate)
    VALUES(9999, 20, TO_DATE('01-JAN-03', 'DD-MON-RR'));
    1 row created.
    SQL> INSERT INTO EMP(empno, deptno, hiredate)
    VALUES(8888, 20, TO_DATE('01-JAN-67', 'DD-MON-RR'));
    1 row created.
    SQL> SELECT empno, deptno, TO_CHAR(hiredate, 'DD-MON-YYYY') hiredate
    FROM EMP;
    EMPNO DEPTNO HIREDATE
    8888 20 01-JAN-1967
    9999 20 01-JAN-2003

    RR was introduced as a Y2K workaround for all those programs that didn't store the century. It has a fixed window - 50 to 99 defaults to twentieth century, 00 to 49 is twenty-first. YY on teh other hand just defaults to the current century. At least in 9.2 it does. I think in earlier version of the database it defaulted to 00 - hence many systems apparently have records that were created in the first century AD.
    SQL> SELECT to_char(to_date('01-JAN-50', 'DD-MON-RR'), 'DD-MON-YYYY')
      2  FROM  dual
      3  /
    TO_CHAR(TO_
    01-JAN-1950
    SQL> SELECT to_char(to_date('01-JAN-49', 'DD-MON-RR'), 'DD-MON-YYYY')
      2  FROM  dual
      3  /
    TO_CHAR(TO_
    01-JAN-2049
    SQL> SELECT to_char(to_date('01-JAN-50', 'DD-MON-YY'), 'DD-MON-YYYY')
      2  FROM  dual
      3  /
    TO_CHAR(TO_
    01-JAN-2050
    SQL> SELECT to_char(to_date('01-JAN-49', 'DD-MON-YY'), 'DD-MON-YYYY')
      2  FROM  dual
      3  /
    TO_CHAR(TO_
    01-JAN-2049
    SQL> Cheers, APC

  • Dependant Dropdown - Format string as date?? And hopefully two dates as a range?

    I'm stuck - been trying to figure this out all afternoon and with a launch in 2 days am probably missing something obvious....so please help me!! hehe<br />I have the a dependent drop down.  The first one is a list of Locations and the second one is then populated by a list of dates that events will be at those locations.<br /><br />1st problem:  when I've been hand coding this drop down I am able to show the start and end date with something like:<br />echo date( 'l, M j', $row_getalldates['date_start']).' - '.date( 'M j',$row_getalldates'date_end']);<br /><br />b How do I translate that into one string to display in wdg:displayfield=""<br /><br />2nd:  Right now since I can't get the two values in...I'm just going with one value so I can continue with development till I figure it out.  <br /><br />I cannot get the date formatted as I usually do with the date() function I usually use. See: http://camp.studentlife.com/housing2/index.php?op=addinfo<br /><br />b SQL STATEMENT:<br />$query_getalllocations = "SELECT distinct(b.title),locationid FROM calendar a LEFT JOIN sllocations b USING (locationid) WHERE b.title is NOT NULL and a.date_start>$mstart_date and a.date_start<$mend_date AND (a.calid='1' ) GROUP BY b.title ORDER BY b.title ";<br />$getalllocations = mysql_query($query_getalllocations);<br />$row_getalllocations = mysql_fetch_assoc($getalllocations);<br />$totalRows_getalllocations = mysql_num_rows($getalllocations);<br /><br />$colname_getalldates = "-1";<br />if (isset($_GET['locationid'])) {<br />  $colname_getalldates = $_GET['locationid'];<br />}else{<br />     $colname_getcalendar = "-1";<br />     if (isset($_GET['eventid'])) {<br />       $colname_getcalendar = $_GET['eventid'];<br />     }<br />     <br />     $query_getcalendar = sprintf("SELECT * FROM calendar WHERE eventid = %s", GetSQLValueString($colname_getcalendar, "int"));<br />     $getcalendar = mysql_query($query_getcalendar);<br />     $row_getcalendar = mysql_fetch_assoc($getcalendar);<br />     <br />     $colname_getalldates =$row_getcalendar['locationid'];<br />     mysql_free_result($getcalendar);<br />}<br /><br />$query_getalldates = sprintf("SELECT a.* FROM calendar a WHERE locationid = %s and a.date_start>$mstart_date and a.date_start<$mend_date ORDER BY a.date_start ASC", GetSQLValueString($colname_getalldates, "int"));<br />$getalldates = mysql_query($query_getalldates);<br />$row_getalldates = mysql_fetch_assoc($getalldates);<br />$totalRows_getalldates = mysql_num_rows($getalldates);<br /><br />b ABOVE MY HEAD TAG:<br />//begin JSRecordset<br />$jsObject_rs_alldates = new WDG_JsRecordset("rs_alldates");<br />echo $jsObject_rs_alldates->getOutput();<br />//end JSRecordset<br /><br />b AND INSIDE MY FORM:<br /><select name="location" class="required" id="location" tabindex="1"><br />   <option value="0" <?php if (!(strcmp(0, $row_rs_alllocations['locationid']))) {echo "selected=\"selected\"";} ?>>SELECT LOCATION</option><br />   <?php<br />do {  <br />?><br />   <option value="<?php echo $row_rs_alllocations['locationid']?>"<?php if (!(strcmp($row_rs_alllocations['locationid'], $row_rs_alllocations['locationid']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rs_alllocations['title']?></option><br />   <?php<br />} while ($row_rs_alllocations = mysql_fetch_assoc($rs_alllocations));<br />  $rows = mysql_num_rows($rs_alllocations);<br />  if($rows > 0) {<br />      mysql_data_seek($rs_alllocations, 0);<br />       $row_rs_alllocations = mysql_fetch_assoc($rs_alllocations);<br />  }<br />?><br />    </select></span></label></p><br />  <p><label><span><br />    <select name="date" class="required" id="date" tabindex="2" wdg:subtype="DependentDropdown" wdg:type="widget" wdg:recordset="rs_alldates" wdg:displayfield="date_start" wdg:valuefield="eventid" wdg:fkey="locationid" wdg:triggerobject="location" wdg:selected="SELECT YOUR CAMP DATE" ><br />    </select></span></label></p><br />1st I though it was the wdg:selected parameter that I could just throw make echo date( instead of just echo.   But no...that would be too easy ;)<br /><br />I figure its either in the "echo $jsObject_rs_alldates->getOutput();" above the head or hard coded into the included ADDT javascript files. Don't mind if I have to hard code as the site's lifespan is short

    Hi Amanda,
    how about preparing that within your query by using a CONCAT function and by formatting the dates right in here, like:
    SELECT CONCAT(DATE_FORMAT(date_start, '%I, %M %j')," - ",DATE_FORMAT(date_end, '%M %j')) AS date_range ?
    The wdg:displayfield expects one table column, and in this case it would be the alias column "date_range".
    Works ?
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Converting a string into Date format

    I am currently using a JSP.
    I currently need to convert a string that holds a date in "dd/mm/yyyy" format to the jva.sql.Date format.
    Any ideas as to what the proper way of doing this is?
    Many thanks ppl

    public java.sql.Date parseDate(String s) {
         java.text.DateFormat dateFormatter= new java.text.SimpleDateFormat("dd/MM/yyyy");
         return new java.sql.Date(dateFormatter.parse(s).getTime());

  • How to convert string to date format?

    Hi All,
    String is in following format: 2006-12-07 i.e yyyy-mm-dd
    I want it in 07.12.2006 date format.
    which function module should i used to convert it?
    Regards,
    Nilima

    an other way to do this :
    Code
    DATA :
    ld_text(20) TYPE c,
    ld_date TYPE datum.
    ld_text = '2006-12-07'.
    REPLACE ALL OCCURENCES OF '-' IN ld_text WITH ''.
    WRITE ld_text TO ld_date.
    WRITE ld_date.

  • String into date format

    Hi
    I was wondering if anyone knew how to convert a string into different formats,
    to enable it to be stored in a mysql db.
    I was wondering anyone you knew how to convert:
    - String into the date format yyyy-mm--dd
    - String into time format 00:00:00
    - string to double
    Ive tried:
    c_date = java.sql.Date.valueOf(f_date);
    System.out.println("conversion data: " +c_date);
    c_time = java.sql.Time.valueOf(f_time);
    System.out.println(" time converted data: "+c_time);
    // string to double conversion
    c_change = java.lang.Double.valueOf(f_change);
    System.out.println(c_change);
    My class doesnt execute this at all?
    Also,
    SimpleDateFormat sdft = new SimpleDateFormat("yyyy-MM-dd");
    c_date = sdft.format(f_date);
    System.out.println(c_date);
    .. but this method returns the error incompatible types?
    Any suggestions would be helpful.. thanks in advance..

    Friends i've got similar kind of problem...can you help me
    here is my code. When i try to print the user entered date (dd/MM/yyyy)(which i am storing in a string) the program dispalys nothing. and everey time i enter a valid date it displas "invalid From date entered ". I need to store the user entered date into a string because i need that for further use. All my intesion is to get two dates from user in dd/MM/yyyy. Strore them in certain variable. Check if they are valid or not. and make sure todate is either equal or greater than fromdate. Please help me to solve this problem.
    public class EDTDateValidation extends JFrame implements ActionListener{
    private JLabel fromlabel;
    private JLabel tolabel;
    private JTextField fromtxt;
    private JTextField totxt;
    private String fmt ="dd/MM/yyyy";
    private java.lang.String fromdate;
    private java.lang.String todate;
    private JButton buttonOK;
    private JButton buttonCancel;
    private Date theDate;
    private Date date1;
    private Date date2;
    private JPanel mainPanel;
    SimpleDateFormat dtformat = new SimpleDateFormat(fmt);
    public EDTDateValidation(){
    super("Date Validation");
    dtformat.setLenient(false);
    mainPanel=new JPanel();
    mainPanel.setLayout(null);
    fromlabel = new JLabel("From Date");
    tolabel = new JLabel("To Date");
    buttonOK = new JButton("OK");
    buttonCancel = new JButton("Cancel");
    fromdate = new String();
    todate = new String();
    fromtxt = new JTextField(10);
    totxt = new JTextField(10);
    fromdate = fromtxt.getText();
    todate = totxt.getText();
    mainPanel.add(fromlabel);
    fromlabel.setBounds(20,20,50,15);
    mainPanel.add(tolabel);
    tolabel.setBounds(20,50,50,15);
    mainPanel.add(fromtxt);
    fromtxt.setBounds(90,20,130,20);
    mainPanel.add(totxt);
    totxt. setBounds(90,50,130,20);
    mainPanel.add(buttonOK);
    buttonOK.setBounds(70,80,71,23);
    mainPanel.add(buttonCancel);
    buttonCancel.setBounds(150,80,71,23);
    buttonOK.addActionListener(this);
    buttonCancel.addActionListener(this);
    setContentPane(mainPanel);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(247,140);
    setResizable(false);
    //pack();
    public static void main(String args[]) {
    try {
    UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    catch(Exception e) {
    System.err.println("Could not load Look and Feel" + e);
    EDTDateValidation edtDateVal = new EDTDateValidation();
    edtDateVal.setVisible(true);
    public void actionPerformed(ActionEvent e) {
    if(e.getSource() == buttonOK){
    System.out.println(fromtxt.getText());
    System.out.println(fromdate); //THIS PRINTS BLANK
    System.out.println(todate); //THIS ASWELL
    try {
    Date date = null;
    date = dtformat.parse(fromdate);
    System.out.println("valid From date entered!");
    catch(Exception f) {
    System.out.println("Invalid From date entered!");
    // textField1.setText("");
    return;
    try {
    Date date = null;
    date = dtformat.parse(todate);
    System.out.println("valid TO date entered!");
    catch(Exception f) {
    System.out.println("Invalid To date entered!");
    // textField1.setText("");
    return;
    }

  • Test String for date format

    Is there a function that reads a string and can return yes/no if the string matches a specified date format (example: mm/dd/yy)? I wish to avoid parsing the string character by character.
    Thanks,
    George

    BTW,
    I used the following example code available from this site. I was able to easily modify it to sovle my problem.
    try {
    SimpleDateFormat formatter =
    new SimpleDateFormat("EEEE, MMMM dd, yyyy");
    Date d = formatter.parse(
    "Tuesday, January 03, 1956");
    formatter = new SimpleDateFormat(
    "EE, MMM d, yy");
    d = formatter.parse("Tue, Jan 3, 56");
    formatter = new SimpleDateFormat(
    "EE, MM d, yy");
    d = formatter.parse("Tue, 01 3, 56");
    process(d);
    } catch (ParseException e) {
    On to the next challenge...
    George

  • ISO date format to local date format

    All
    I have a requirement to convert the given ISO date format String to local date format String
    Can someone give the the piece of code to do this
    e.g I receive the following String "2003-03-15T09:00:00" and need to convert this to "03/15/2003 09:00:00"
    Thanks

    Check out java.text.SimpleDateFormat.

  • Transforming Multiple Date Formats to Consistent Date Format

    I have a power query with some sources use the date format "2014-01-31" and the others use "42029". When I Transform the column to a Date data type, the "2014-01-31" format gets transformed but the "42029"
    stays the same.
    How do I fix this so all dates are in the same format?

    I think one o the issues here is that the format is ambiguous and while the date transform function tries to be very lenient in terms of what it will accept, it can only go so far. If you convert the date to a number first, then Date.From is actually going
    to give you what you want.
    Are there any other columns in your table that can indicate in which format the date it? Otherwise, you could do something like this:
    = Table.AddColumn(Source, "Custom", each if Text.Contains([DateColumn], "-") then Date.From([DateColumn]) else Date.From(Number.From([DateColumn])))
    Here I check if the date string has a "-". If it does, I use Date.From and if it does it I use Date.From with Number.From.
    Tristan

  • How to get year format result on date format in Bex

    Hi,
    I have requirement to display only year and month in seperate rows as a result in Bex.
    I have created on date field like MM/DD/YYYY and i have to display in two seperate rows as MM/YYYY and YYYY.
    Could anyone please suggest me how i can display these format in Bex.
    thanks in advance.

    Hi Prashant
    Regional settings of Windows are used to dispaly Date format in Bex reports.
    you neesd to change the settings in Regional settings:
    Control Panel-> Regional settings
    this will change to the desired Date format.
    Regards
    Vivek Tripathi

  • I want to delete a whole line in txt file where i found a string with DATE format.

    #The date have specific format  mm/dd/yyyy
    #I Need to find a line where is date older than one year and then erase it
    $Date = (Get-Date).AddDays(-365)
    write-host "-----------------------"
    $a= '\d{2}\/\d{2}\/\d{4}'
    Select-String -pattern "$a"  -Path C:\test\file.txt -AllMatches |
        ForEach-Object {
            $Info = $_ | #
                Add-Member -MemberType NoteProperty -Name Date -Value $null -PassThru |     
                Add-Member -MemberType NoteProperty -Name Captured -Value $null -PassThru   
            foreach ($Match in $_.Matches) {
                try {
                    $Date = [DateTime]::ParseExact($Match.Value,"MM\/dd\/yyyy",$null)     
                 if($Datum -lt $Date){
                     write-host "$Date is up to date"
                        else{
                            write-host "$Date is old" }  # here should be command which delete the line
            catch {
                    $Date = 'NotValid'

    Or you can use Set-Content like in mjolinor's example, or just pipe to out-file like I suggested, but in both cases you'd need to enclose the get-content in parentheses:
    $Date = (Get-Date).AddDays(-365)
    $a= '\d{2}\/\d{2}\/\d{4}'
    (Get-Content C:\test\file.txt) |
    Where-Object {$_ -notmatch $a -or $(Select-String -pattern "$a" -inputobject $_ -AllMatches |
    Foreach-Object {$good = $true;$(Foreach ($match in $_.matches) {If([datetime]$match.value -lt $date){$good = $False}};$good)})} |
    Set-Content C:\test\file.txt
    Make sure it works as expected then change the filename to file.txt or test it without piping it to file by reviewing it in the console first.  Do you have multiple dates on any lines of your text file?  If not, the other answers are more appropriate.
    I hope this post has helped!

Maybe you are looking for

  • Rendering problem in cs6

    A particular project I am working on will not render in cs6.  Every time i try to render the timeline it freezes about 1/3 of the way through.  I can render one clip at a time for a few clips but then it consistently freezes after about 3 renders and

  • Library Filter keyword sort

    How do you sort (assending/decending) keywords in Library Filter Default columns?  Lightroom 5.2.  Mine begin with Z; I have seen others that begin with A.

  • N97 unlocking keypad freezes

    Hey Just wondering if anyone has a similar problem with their N97. When I go to unlock my keypad with the slide device on the site my phone will often completely freeze up and I will have to remove the battery. This has become rather annoying now. Do

  • Internet Procurement for Japanese Language

    Hi , I want to setup Internet Procurement for Japanese Language, want is the setup required. I am currently, in 11.5.10.2. -Thanks-

  • Nokia 5800xm can't connect to internet or ovi stor...

    Nokia 5800xm can't connect to internet or ovi store. Just got my phone back after a Firmware reset. Now it can't connect to internet or ovi store. It keeps coming up with Invalid Server Name. Can anyone help Solved! Go to Solution.