Force 2 digit month, 2 digit days and 4 digit year.

I have input date format month/day/year. 
The possible input may be like following:
  1/1/2006, 1/12/2006,
10/1/2006, 10/12/2006.
in summay the 'day' may be 1 or 2 digit, the 'month' may be 1 or 2 digit.
How do I make them all 2 digit 'day', 2 digit 'month' and 4 digit year.  My final goal is convert it to 'YYYYMMDD'.
Here is my code:
TYPES :BEGIN OF type_int_date,
            l_year(4)   TYPE c,
            l_month(2)  TYPE c,
            l_days(2)   TYPE c,
          END OF type_int_date.
DATA:l_startdate    TYPE string,
     l_month        TYPE string,
     l_days         TYPE string,
     l_year(4)      TYPE c,
     lw_date        TYPE type_int_date,
     l_len TYPE i.
SPLIT l_startdate AT '/' INTO
          l_month
          l_days
          l_year.
    l_len = <b>strlen</b>(l_month).
    IF l_len = 1.
       CONCATENATE '0' l_month INTO lw_int_date-l_month.
    l_len = strlen(l_day).
    IF l_len = 1.
       CONCATENATE '0' l_days INTO lw_int_date-l_days.
    lw_int_date-l_year = l_year.
    zzstartdate = lw_int_date.
I have syntax error on the 'strlen'.  The compiler do not understand the 'strlen'.
Please help.
Thanks,
Helen

Please implement my sample program above, run it?  Any problems? If so, then I guess that you user date format is set as MM.DD.YYYY.  Which in this case will not work for you.  Neil has suggest that you translate the / to .  This may work, again, if your user date format is MM.DD.YYYY.
report zrich_0001.
data: im_datum(10) type c value '1/1/2006'.
data: ex_datum type sy-datum.
<b>translate im_datum using '/.'.</b>
call function 'CONVERT_DATE_TO_INTERNAL'
     exporting
          date_external = im_datum
     importing
          date_internal = ex_datum.
write:/ ex_datum.
REgards,
Rich Heilman

Similar Messages

  • MTD(Month To Date) and YTD(Year To Date) with one example

    can any ont Explain about MTD(Month To Date) and YTD(Year To Date) with one example plz

    Hi,
    Can you please elaborate.
    MTD is from the 1st of the current month till today's date.
    YTD is from 1st Jan till today's date.
    If you trying to build this is query. Create restricted key figure and put restriction on calday with a customer exit for the same.
    Thanks,
    S

  • For the previous month first day and last day

    i want to schedule my reports from the last month first date to last month last date.
    any body have queries for the while scheduling to uuse it.
    Ex:sysdate() - today's date
    first_day_of_month()- first day of current month
    first day of last month ---?
    last day of the last month ---?

    In the parameter, put this
    {$FIRST_DAY_OF_MONTH()$}other values you can use in default parameter values are
    {$SYSDATE()$} - to get current date
    {$FIRST_DAY_OF_MONTH()$} - to get first day of the current month
    {$FIRST_DAY_OF_YEAR()$} - to get first day of the current year
    {$LAST_DAY_OF_MONTH()$} - to get last day of the current month
    {$LAST_DAY_OF_YEAR()$} - to get last day of the current year
    Re: Default date as first of month
    TO get last day of last month
    {$FIRST_DAY_OF_MONTH()-1$}You can add/subtract number with these functions and no other functions are available.

  • Calendar day and Calendar Year/Week  mapping

    Dear SDN,
    I am unable to view Calendar Year/Week and Calendar Day ...Data..
    I have observed that they have not mapped in the Update rules of 0SD_C03 InfoCube...
    I have checked all the InfoSources (2LIS_11_VAHDR, 2LIS_11_VAITM, 2LIS_11_V_ITM, 2LIS_12_VCHDR, 2LIS_12_VCITM, 2LIS_13_VDHDR, 2LIS_13_VDITM)...
    There in all the Update Rules...
    Update Rules -- Details -- Time Ref.---
    Time Characteristic of Fiscal Year Variant is mapped with Source fields of Fiscal Year variant
    similarly,
    Calendar Year/Month is mapped with Update Date Statistics
    But Calendar Year/Week and Calendar Day are Blanck...
    I am thinking they also should be mapped..
    Please suggest me how to resolve this...
    Help will be greatly appreciated with points..
    Thanks in advance..
    This is very urgent...

    Thanks...
    But i have already assigned my self...
    0calyear/week to Update date statistics...
    and
    0calendarday to Update date statistics..
    I have assigned points to you...
    Thanks for your informatioon

  • Todate and AGO function in both Fiscal yer and Calendat year

    I want to create report having column with Todate and ago function formulas. I have to display the facts both in fiscal year and calendar year... how to do this? What value shall i choose in the content tab for the time dimension in this case? My fact table has values for each day...
    I am able to display only columns with fiscal year in time series function with timeDim.fiscal_year... similarly only calendar year with time seriese with calendar year columns... In my hierarchy, I have two branches for Time Dim...one is Fiscal and other is Calendar... and they both are at same level
    Help!

    I have an answer for you...Since you have a correctly defined time dimension (with branches - Fiscal Year->Fiscal Qtr ->Fiscal Month->Fiscal Week and Calendar Year->Cal Qtr->Cal Month->Cal Week->Cal that I assume have the common Child level - Day...) - you should have no problem building time-series logical columns
    In TODATE and AGO you must use relevant Time Dim Level - for example:
    AGO (Column, TimeDim.FiscalYear, 1) = would give you data for previous fiscal year
    AGO (Column, TimeDim.CalYear, 1) = would give you data for previous calendar year
    same goes for qtrs, months, weeks
    If you want to take it to the lowest level Day - it won't matter if you pick Fiscal or Calendar since it's essentially the same.
    I hope this is helpful

  • Loading single digit months with SQLLDR

    How can I load dates with the month having a single digit using sqlldr??
    62305220507 in this example the date is 23-Jun0-05 22:05:07
    111804115452 in this example the date is 18-Nov-04 11:54:52
    I've tried the date mask mmddyyhh24miss but only the double digit months get loaded.
    Thanks,
    Paul

    How about something like this
    my_date CHAR "to_date(lpad(:my_date, 12, '0'), 'mmddyyhh24miss')"P.S. And maybe you should consider to use RR rather than YY for the two digit year?

  • Unable to email a document.  Keep getting error message:  Invalid Date Enter 2-digit month

    Unable to email a document.  Keep getting error message:  Invalid Date Enter 2-digit month
    Does not happen with all forms which emante from same USG webpage
    Any adivice?

    If i am using 11G andrtp is 11g but on rtp side if they configure SSL, is it mandatory to do it from our side also?No it not mandatory to enable SSL at your end however you have to configure identity and trsut at your end.
    Any update on my regular question(The main forum question)?You mentioned that you are posting message from 10g to 11g and as per log you are sending it to URL - https://dev-nog.server:443/b2b/transportServlet
    So few things which I see as a problem are-
    1. You should use URL https://hostname:soa_server_ssl_port/b2b/httpReceiver instead of https://dev-nog.server:443/b2b/transportServlet
    2. SOA server SSL port should be enabled (SSL should be enabled on SOA server)
    3. You should configure wallet at 10g side to contain trust cert of 11g server
    Regards,
    Anuj

  • MOSS 2007 Monthly Calendar view wont accept a single digit month

    If any of my users try to change the Month of the Monthly Calendar view, by clicking the arrows to the left of the current display month, they get a blank page.
    The url they are sent to is as follows:
    https://~/Lists/Calendar/calendar.aspx?CalendarDate=6%2F16%2F2014
    If they insert a zero in front of the month digit SharePoint displays the page perfectly fine. ie:
    https://~/Lists/Calendar/calendar.aspx?CalendarDate=06%2F16%2F2014
    Here is where it gets strange, my staging environment will display the first URL and the second URL as expected, my production and dev environments choke on a single digit month.  All environments display Oct, Nov, and Dec just fine because they are
    2 digit months.  All servers are Windows Server 2008R2 SP1 and Sharepoint build 12.0.0.6679
    Anyone seen this before?  I have checked, and changed, the regional settings for date format.  They are all set to M/dd/yyyy and changing it had no effect.

    Hi Matt,
    Could you share a screenshot about this issue?
    Did this happen to all site collections and web applications?
    Where did you set the date format as M/dd/yyyy?
    Have you checked if there is any error on the page with different browsers(or with F12 developer tool)?
    Thanks,
    Daniel Yang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] 
    Daniel Yang
    TechNet Community Support

  • IPhone has WEIRD letters for the months and days of the year !

    Hi !
    One morning I woke up to find that the DAYS and MONTHS of my year are in WEIRD letters ! Here is an image to clarify my problem:
    http://sphotos-g.ak.fbcdn.net/hphotos-ak-ash4/480863_10200219386720818_166986027 2_n.jpg
    Oh, I understand that I'm using the iStudiez app to demonstrate the problem, but the flaw applies all over my phone.
    Thank you all in advance for your time and help !
    -eXtremity.

    Thank you SO MUCH !!! I can not begin to explain how annoying it is trying to figure out when my classes begin with these weird letters. Problem has been solved. You good sir are a legend. Thanks again !

  • SQL select Statement -first day and last day of the month - 1 year from now

    Hi,
    I need to write a SQL to get the dates in between first day and last day of the month one year from now.
    SELECT last_day(add_months(sysdate,12)) as lastday from dual
    What could be the Query to get the first day of the month one year from now..
    ie ..Sysdate - 3-DEC-2009
    Result - 1-DEC-2010
    thank you

    Hi,
    You can use TRUNC with 2 arguments to get the first DATE in a month, year, quarter, week, hour, minute, ISO year, ...
    SELECT  TRUNC ( ADD_MONTHS ( SYSDATE
                               , 12
                  , 'MONTH'
                  )     AS first_of_month
    FROM    dual
    ;The DATE returned will be in the same month, year, quearter, ... as the first argument.
    \We convered the last day of the month in [your previous question|http://forums.oracle.com/forums/message.jspa?messageID=3942939#3942939].
    At that time, I warded about using LAST_DAY as a cutoff point; TRUNC is a much better way.
    For example, to find all appointment_dates in the current month next year:
    SELECT  *
    FROM    appointments
    WHERE   appointment_date >= TRUNC (ADD_MONTHS (SYSDATE, 12), 'MONTH')
    AND     appointment_date <  TRUNC (ADD_MONTHS (SYSDATE, 13), 'MONTH')Note that
    the first part of the WHERE clause calls for dates on or equal to the beginning of the 12th month in the future, but
    the second part of the WHERE clause calls for dates before, not equal to , the beginning of the 13th month in the future.

  • Find space between word with different endings and digit

    Hi,
    I'm trying to figure out how to find spaces between word and digit.
    I am limited to use only word 'WORD' (either capital or small caps) with different endings like -ing -s -y and more (using \S+).
    I wrote something like (?i)(?<=WORD\S+)\s(?=\d+) but this does not seem to work due to some limitation of lookahead I belive?
    Any suggestions?
    Peter

    Peter Stnsz wrote:
    … find what: (\<WORD\S+)(\s)(?=\d)
    change to: $1~s
    Hmmh?
    Your Grep do not find your first example: WORD 0,2 (WORD without any ending)
    And you don't need the second ()
    And please do not use \S
    Use this instead:
    (\<WORD\l*)\s(?=\d)
    (l is the little L)
    Have fun

  • When I edit a midi track and dig on a note, I can no longer hear it.   Has something been turned off?

    When I edit a midi track and dig on a note, I can no longer hear it.   Has something been turned off?

    If "digging" is "clicking" and if you mean to ask if anyone can hazard a guess as to what is going on in your particular version of Logic, then I'd say this little button
    is not green anymore.

  • Dates showing up as day of the year vs. day and month

    hi; on my work imac, for some reason dates are labeled as the number of the year (as in 64 March) vs. the day and month. it happens in Mail and assigning dates to files that were created.
    anyone know how to fix this?
    thx, charlie

    Open the International pane of System Preferences, click on Formats, choose Customize to the right of Dates, and correct the formats.
    (34004)

  • Logic Gold 5.5.1 and Digi 001

    After formatting my computer, logic and digi 001 wont communicate in OSX anymore. I have installed both OS 9 and OSX, and in OS 9 it work fine. But when i try to launch Logic (5.5.1) in OSX i get this error message: Error code 28519 was returned buy the core audio driver...
    The Core audiodriver is installed in Library/audio/plugins/HAL! But i have no clue about SystemInit and Direct I/O (versions or were to put the files on the computer.
    I have also tried with and without the Protools software installed but that did´nt work either.
    PLEASE someone, help me. I have tried and tried but nothing seems to work. Before the formatting everything worked fine, but not anymore...
    What´s wrong?

    Hi,
    Why exactly did you format your computer?
    Did Logic Gold 5.5.1 work on you OSX BEFORE you reformatted?
    What changed from before your format to after (any driver versions changed/automatic updates?)
    Remember,Digidesign does NOT support Digi001 anymore,so which Audio driver(DAE/CoreAudio) did you use before you reformatted?
    From Digidesign's website Answerbase:
    Core Audio error 28519 when trying to use the Digidesign Core Audio driver in a third party application (Logic, Reason, etc.).
    This error can have several different causes. Some things to check:
    1. Is another application using the core audio driver, such as the Sound control panel in your System Preferences panel? If so, you'll need to quit that application or switch your Sound control panel back to built in hardware. Keep in mind the Digidesign core audio driver is single client - only one application can be using the hardware at any time.
    2. Is your Digidesign hardware turned on and powered up? You may try turning off and turning back on the hardware and restarting your application.
    Also see Answerbase #27816 for other possibilities specific to Emagic Logic:
    Getting an error message -28519 in Logic Audio 6.3. when changing to Digidesign hardware for the CoreAudio output.
    These errors can be caused by two plugins that are installed when updating Emagic's Logic to version 6.3.1
    Removing these two plugins from the plugins folder may solve the issue.
    The plugins folder is located in the
    MacHD / Library / ApplicationSupport / Digidesign / Plugins
    Remove
    - ESB TDM OSX
    - ESX 24 TDM OSX
    If these plug-ins are installed, when launching Pro Tools, you will get an error message: When attempting to launch you get either: "- 6003 Emagic system bridge error"
    or "- 6003 error while initializing TDM host streams." (see Abase # 27414). Remove the plug-ins above to solve this problem.
    Without knowing why you reformatted,it is harder to help.
    I hope the Digidesign Answerbase messages help you out.
    Cheers,
    Nick
    iBook G4 800mHz   Mac OS X (10.4.3)   640MB RAM/ProTools 6.9/LogicPro7.1.1

  • ICal events are missing Day and Month in date

    Hello, Sorry if this has been addressed elsewhere - this is such a weird fault I was not sure how to search for it.
    My iCal events are missing the Day and Month in their start and end dates - it just shows a 4 digit year which can only be edited as a 4 digit number. All my events are in their correct places but I am unable to create new multiday events.
    This applies to old and new events alike. I tried trashing my iCal prefs file but it made no difference.
    Anyone any ideas? I am using iCal 3.0.8 on Leopard 10.5.8.
    Thanks in advance.

    Worked it out - I was using a custom date format to give me day and date in the menu bar - reverting to one of the standard built in 'British' works - but then I lose my day in the menu bar....

Maybe you are looking for

  • NAT (INSIDE To OUTSIDE)

    I need Configuration of this topology At Outside Router int f0/0 ip add 10.1.1.2 255.255.255.0 At Inside Router int f0/0 ip add 192.168.1.2 255.255.255.0 At ASA int e0 ip add 10.1.1.1 255.255.255.0 int e1 ip add 192.168.1.1 255.255.255.0 I want NAT f

  • Shutdown graphical glitch

    When my 2011 27" iMac is shutting down and the screen is all black and about 10 seconds from shutting completely off, about 50 white pixels appear on the lower left side of the screen and make a wave pattern for a few seconds. I have a video but am u

  • ( Off Topic ) Is there anyway that we can live chat people that need our help?

    Please Dont get made, This is off the Topic i understand. But i would like to help people as much as i can. I was just wondering if there is a live chat somewhere that we can instanst chat people that need our help?

  • Suppressing a section based on two conditions

    Hello currently, I am trying to suppress a section of group based on two conditions: - The first condition is to suppress the section always if the user is not at DrillDownGroupLevel 1. - The second condition is to supress the section if the GroupNam

  • Create a drill down in function

    HI all, I could need some help, but I don't know if it is even possible. Currently we use in a BI-IP workbook two levels on input. We use a filter setting in workbook function to give other chars filter values. Example of the problem: We've a layout