Date Field Formatting

Hi All,
I'm back already! Learning Flash is beginning to get to me
again so I returned for yet more help!
I've written the following AS code to get tomorrow's date . .
// Calculates today's date and tomorrow's date
var dToday:Date = new Date();
dToday.getDate()
trace("today: " + dToday) //today's date
myD = dToday.getDate() + 100; // plus one day
var dTomorrow:Date = new Date();
dTomorrow.setDate(myD)
trace("new: " + dTomorrow) //tomorrow's date
var strDate:String = new String();
var strDate = String(dTomorrow);
trace("String: " + strDate);
The strDate string returns the following value . . . "Tue Jul
11 16:19:57 GMT+0100 2006".
That is all well and good but I want to convert it into the
following format for comparison with another field . . .
"200607111619" which is basically the same value in the following
format . . . "yyyymmddhhmm".
Does the only way of doing this involve using parsing logic
to break down the original string and then reconstruct it in the
required format using variables from the broken down original
string?
I have tried looking at the Date Field object notes in my
book but it does not give me anything as regards this programming
requirement. The only thing I can find that might suit this purpose
is string parsing logic. Am I right or is there an easier way to
set a date field format?
Any help would as always be much appreciated!
Thanks,
Kevin.

I'm working on an application which requires a valid Voucher
Number to proceed. The Voucher number is based on a combination of
'date/time/no of items' (e.g. 20060711095802 which is today at
09:58 (on a 24 hr clock) for 2 (02) items).
As this date this date/time Voucher Number logic is
essentially sequential, in that each subsequent Voucher Number will
be greater than the last good known Voucher Number entered into the
application (which is already stored in a variable field for
comparison). But it must also be less than tomorrow's date, for
which the Voucher Number would always be tomorrow's date (e.g.
20060712 at 00:00 hrs for 00 items, thus giving 20060712000000).
This is the value that I'm trying to ascertain from the date field
logic.
It would thus be really handy for comparison if I could just
format tomorrow's date and time in the format yyyymmddhhmm and just
add '00' to the end of the string.
I don't like the idea of using the milliseconds value as it
will be necessary then to convert the Voucher Number entered to a
date field for comparison.

Similar Messages

  • Determine Date field format dynamically

    Hello friends,
    I'm writing some database access code in java. The biggest problem I face is date fields. Because I don't know the date field format (For example, in SQL Sever we can have dd/mm/yy or mm/dd/yy, etc), I can't format dates for insert/update statements.
    Is there a way to determine the date field format dynamically? Regardless of database, for ex. MS SQL, Oracle?
    Thank you.

    Hey!
    There is a way to do this! The Oracle Database understands SQL92 Syntax. So you can use
    - {d ?yyyy-mm-dd?} for date representation,
    - {t ?hh:mm:ss?} for time representation,
    - {ts ?yyyy-mm-dd hh:mm:ss.f...?} for timestamp rep.
    Here is a small example:
    // Connect to the database
    // You can put a database name after the @ sign in the connection URL.
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:oci8:@", "scott", "tiger");
    // Create a Statement
    Statement stmt = conn.createStatement ();
    // Select the ename column from the emp table where the hiredate is Jan-23-1982
    ResultSet rset = stmt.executeQuery
    ("SELECT ename FROM emp WHERE hiredate = {d ?1982-01-23?}");
    // Iterate through the result and print the employee names
    while (rset.next ())
    System.out.println (rset.getString (1));I hope this is what you wanted to know!

  • Browser date field format in header

    I am using Browser 2.0 for some ad hoc queries on an Oracle
    7.2.3 database.
    My client is running Windows NT 4.0 with Service Pack 4.
    Regional settings are set to English (Australia).
    The page setup in Browser allows you in the header or footer to
    insert the a date field via "&d". Documentation states this is
    system generated.
    However, in the print preview and print out the date is
    formatted as MM/DD/YY. I need to have it formatted as DD-MON-
    YYYY.
    Can anyone suggest to me from which system the format is being
    generated or any
    suggestions on how to change it in.
    Thanks
    null

    can you paste the timestamp being displayed?
    You can use, format-date function or other, but its all based on the data you have for DATE.

  • DTW Date Field Format

    Hi,
    I'm trying to import some UDF information into Business Partners, but one of my UDFs is set up as a Date field. What format of date shoul be in the import file becasue DD/MM/YYYY doesnt import so I tried YYYY/MM/DD and this doesnt work either.
    Thank you x

    Hi,
    Check this thread.
    Re: defining date possible while doing DTW import to Goods Receipt
    regards,
    Fidel

  • Conversion of date field format from char to dats

    Hi All,
    one issue with Date field.
    in my internal table i have a date field with type char(10).
    But when I upload the data to database through upload program,  there I have a date field with type "DATS".
    how do I convert and store it in "DATS " format in database.
    please help...

    HI ,
    Try this use  CONVERT_DATE_TO_INTERNAl
    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
      EXPORTING
        date_external                  = "ur date from file
      ACCEPT_INITIAL_DATE            =
    IMPORTING
    DATE_INTERNAL                  =  "( date in dats format )
    EXCEPTIONS
      DATE_EXTERNAL_IS_INVALID       = 1
      OTHERS                         = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • The data field format for the sql* loader

    the data field in my data file was surrounded by ",", such as "1","2","3",...
    so in my control file, I coded
    fields terminated by ',' enclosed by '"'
    no error after I execute sqlldr command.
    however, on data has been inserted into table either.
    if I remove "" and ,
    the data field changed to 1 2 3 ...
    and the data has been inserted into my table
    However the first format is what I want. can anyone experienced silmilar situation? please give me a hint.
    your help is highly appreciated
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Renali ():
    say:
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS (
    colname1,
    colname2,
    colname3)
    the data field in my data file was surrounded by ",", such as "1","2","3",...
    so in my control file, I coded
    fields terminated by ',' enclosed by '"'
    no error after I execute sqlldr command.
    however, on data has been inserted into table either.
    if I remove "" and ,
    the data field changed to 1 2 3 ...
    and the data has been inserted into my table
    However the first format is what I want. can anyone experienced silmilar situation? please give me a hint.
    your help is highly appreciated
    <HR></BLOCKQUOTE>
    null

  • IDoc posted in R/3 but data for Date field has not generated.

    Hi Experts
    This is JDBC to IDoc scenarion.
    Source: MS SQL Server
    Date Data Type: smalldatetime
    Date field Format: yyyy-MM-dd hh:mm:ss --> example: 2009-11-13 00:00:00
    XI Mapping: Source Date --> Transformation --> Target Date
    Transformation: yyyy-MM-dd hh:mm:ss to yyyyMMdd
    Target: R/3 System
    Date Data Type:  ERDAT from VBAK table - Date on Which Record Was Created
    Date field Format: Date field (YYYYMMDD) stored as char(8)
    Check points:
    1. Mapping is working fine in XI and transformation is done with the test data: 2009-11-13 00:00:00  --> to ---> 20091113
    2. In SXMB_MONI the data is processed from the source and the IDoc XML data is generated. In the IDoc XML data the date field is containing the value <DATE>20091113</DATE>
    3. But when I tried to open the IDoc(SE05) in R/3 the date field is empty and no data is generated.
    Request you to let me know why the error is happening.
    Regards
    Ram

    Hi Ram,
    First try to test the same IDOC generated in ECC Box by populating date field value using WE19 and test .
    Or
    Instead of passing date value from SQL Server, Just give a try with  Current Date function in Mapping and test in ECC system.
    then we can think on further analysis.
    Regards,
    Vijay

  • In BDC programming how can we maintain date field

    hello all
    In BDC programming how we will deal with date field?
    In my flat file my date field format is different from the sap date field format. how can we deal this?

    hi,
    just define a variable with length 10 in ur internal table.
    now pass the date format in flat file as dd.mm.yyyy.

  • Abap date field and calendar in iView

    When I create an iView out of a transaction which has a date field,the iView cannot display the calendar in the portal.Just an Empty dialog box appears in place of the calendar.
    Please help.
    regards,
    Bhupesh

    Hi,
    that's quite easy to realize with FormCalc.
    In you date fields exit event add the following code:
    textField1 = Num2Date( Date2Num($.formattedValue, "MM/DD/YYYY"), "YYYY")
    Note: This sample assumes that your date field formats the date with "MM/DD/YYYY". You may have to change the pattern to make it work at your end.

  • Extract Year (only) from Date Field and Display in Text Field

    I need to extract the year from a user entered date field and display the year in a text field. Can someone help me with the correct script to do this?

    Hi,
    that's quite easy to realize with FormCalc.
    In you date fields exit event add the following code:
    textField1 = Num2Date( Date2Num($.formattedValue, "MM/DD/YYYY"), "YYYY")
    Note: This sample assumes that your date field formats the date with "MM/DD/YYYY". You may have to change the pattern to make it work at your end.

  • How to display date field in ALV in format 'YYYY-MM-DD'?

    Hi experts,
    I am not getting displayed the date field in ALV in the format 'YYYY-MM-DD' if it is different than my user setting's format (DD.MM.YYYY).
    Tried with the edit mask
    LVC_S_FCAT-EDIT_MASK = '____-__-__'  but it does not work.
    I could not find the conversion routine for this. Is it possible to write customer conversion routine?
    I have to use DATE field, otherwise if I display this format in CHAR10 field , sorting in ALV does not work for this field.
    PLEASE ANY HELP!
    Kind regards,
    Danijela

    Hi,
    Use FM FORMAT_DATE_4_OUTPUT.
    TYPE-POOLS : slis, KKBLO.
    TYPES: BEGIN OF t_data,
           sel     TYPE char1,
           matnr   TYPE matnr,
           bldat   type char10,
           END OF t_data.
    DATA: it_tab TYPE STANDARD TABLE OF t_data,
          it_fcat TYPE slis_t_fieldcat_alv.
    DATA: wa_tab TYPE t_data,
          wa_fcat TYPE slis_fieldcat_alv,
          wa_layout type SLIS_LAYOUT_ALV.
    data: lv_repid    TYPE syrepid.
    data : lv_date    type NLEI-IBGDT,
           lv_outdate type RN1DATUM-DATEX,
           lv_format  type RN1DATUM-FORMAT value 'YYYY-MM-DD'.
    lv_repid = sy-repid.
    lv_date = sy-datum.
    CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
      EXPORTING
        datin         = lv_date
        format        =  lv_format
    IMPORTING
       DATEX         = lv_outdate.
       move lv_outdate to wa_tab-bldat.
    wa_tab-matnr = '0000001'.
    APPEND wa_tab TO it_tab.
    lv_date = sy-datum + 1.
    CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
      EXPORTING
        datin         = lv_date
        format        =  lv_format
    IMPORTING
       DATEX         = lv_outdate.
       move lv_outdate to wa_tab-bldat.
    wa_tab-matnr = '0000002'.
    APPEND wa_tab TO it_tab.
    lv_date = sy-datum + 2.
    CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
      EXPORTING
        datin         = lv_date
        format        =  lv_format
    IMPORTING
       DATEX         = lv_outdate.
       move lv_outdate to wa_tab-bldat.
    wa_tab-matnr = '0000003'.
    APPEND wa_tab TO it_tab.
    wa_fcat-fieldname = 'SEL'.
    wa_fcat-ref_fieldname = 'XCHPF'.
    wa_fcat-ref_tabname = 'MARA'.
    wa_fcat-edit = 'X'.
    wa_fcat-checkbox = 'X'.
    APPEND  wa_fcat TO  it_fcat.
    CLEAR :  wa_fcat.
    wa_fcat-fieldname = 'MATNR'.
    wa_fcat-ref_fieldname = 'MATNR'.
    wa_fcat-ref_tabname = 'MARA'.
    APPEND  wa_fcat TO  it_fcat.
    CLEAR :  wa_fcat.
    wa_fcat-fieldname = 'BLDAT'.
    wa_fcat-ref_fieldname = 'BLDAT'.
    wa_fcat-ref_tabname = 'BKPF'.
    APPEND  wa_fcat TO  it_fcat.
    call 'REUSE_ALV_GRID_DISPLAY'' after this
    Edited by: Ankur Parab on Oct 1, 2009 2:50 PM
    Edited by: Ankur Parab on Oct 1, 2009 2:51 PM

  • Formatted Search for Delivery Date field in SO not working

    Hi All
    Can anyone help me as to why my formatted search is not working?
    I am currently using SAP B1A SP01 Patch 19.
    I have created a user query as follows:
    SELECT $ [$10.0.DATE] + 5
    When I add this to the delivery field within the Sales Order and bring through the saved query which I set to auto refresh when the Posting Date field changes and to Display Saved Values it doesn't work.
    Any ideas?
    Thanks and best wishes
    Gail

    HI Gail,
    If I am not mistaken you want to add days to the posting date...if that is so then try this out:
    SELECT $[ORDR.DocDate.DATE]+5 From ORDR T0 For Browse
    Set The indicator to Auto Refresh when the fields change
    Nagesh

  • Format of Date field is loading wrongly in the Infocube 0pp_c01.

    Hi,
    Format of Date field is loading wrongly in the Infocube 0pp_c01. But it is loading properly into PSA.
    I am loading data into PP infocubes from the following DataSources.(they all are 3.x datasources)
    1. 2LIS_04_P_MATNR
    2. 2LIS_04_P_ARBPL
    3. 2LIS_04_P_COMP
    The data is coming properly upto PSA.  For example Actual Start date is loaded in cube like 733.884.
    And, it is the same issue with all the cubes. So I checked the update rules. But, in it the mapping is done properly.
    Thanks $ Regards
    Shyne Sasimohanan
    +91-9632674245

    Hi,
    HEre also value is loaded correctly. The reason u are seeing it in this format is because it is mapped into a key figure in the info cube.
    It will store the value as number of days from a standard date like 1/1/1000 or 1/1/1900 - not sure which one of these, u should be able to search and find the correct date in the forums..but this is the logic behind it
    Hope it helps.
    Regards,
    Rathy

  • Error when saving a default format for a date field in 11g

    Getting this error when attempting to save the default for a date field in 11g:
    The current xml is invalid with the following errors: Bad xml instance! <?xml version="1.0"?> <sawsavedformat:metadata xmlns:sawsavedformat="com.siebel.analytics.web/savedformat/v1.1"><sawsavedformat:columnSavedFormats><sawsavedformat:columnSavedFormat xmlns:saw="com.siebel.analytics.web/report/v1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="sawsavedformat:regularColumnSavedFormat" columnName="&quot;Retrospectives&quot;.&quot;Time Dim&quot;.&quot;Two Months Ago&quot;"><saw:displayFormat><saw:formatSpec suppress="suppress" wrapText="true" visibility="visible" hAlign="left" vAlign="top"><saw:dataFormat xsi:type="saw:custom" customFormat="MMMM dd, yyyy" displayTimeZone=""/></saw:formatSpec></saw:displayFormat><saw:tableHeading><saw:displayFormat><saw:formatSpec/></saw:displayFormat></saw:tableHeading><saw:columnHeading><saw:displayFormat><saw:formatSpec/></saw:displayFormat></saw:columnHeading></sawsavedformat:columnSavedFormat></sawsavedformat:columnSavedFormats></sawsavedformat:metadata>
    Line:2, Col:608, Attribute 'displayTimeZone' is not declared for element 'dataFormat'
    Thoughts and suggestions?

    I have a Support Request open with Oracle right now (it's taking a few weeks to resolve) but here's the update:
    OBIEE 10g handles DATE types differently than 11g. Both the support rep and I can't figure out how, but they are different. If you bring the column in as a DATETIME in your Physical Layer you can't save it system-wide, even if you do set a time zone for your account (My Account -> Preferences -> Time Zone). If you bring the column in as DATE you can save it system-wide but you can't display the hours/mins/secs, only the M/D/Y. This has been tested on a 9i and 10g database and produced the same thing on both. The problem never occurred with those same columns using OBIEE 10g.
    Oracle support has not fully admitted this as a bug, but the rep working on this SR said this will probably be fixed in the next release- 11.1.1.4, which is due out late Jan/early Feb of this year. He is trying to reproduce this so he can log it as a bug (which we all are hoping for!) so Oracle can address it.
    For now, I've found that you are stuck with two options: 1) bring the column in as a DATE, display it system-wide as a saved format, but you can't show the time, and 2) don't save that date value with a system-wide formatting and set it manually on every report you need a custom format (don't forget to set your time zone).
    If I hear anything more back from Oracle support I'll update this thread.
    Sorry guys, looks like we're all stranded on this one...

  • Formatting a date field

    I am trying to format a date field so that it shows as 06/29/2005 instead of 06/29/2005 00:00:00. Im thinking that I need to use the Substr function to do this but cant get it to work. Here is what I have, @(Substr(REQUIRED_DATE,1,10)). Any help would be great.

    The field is set up as a text field. From what I have read in Help, $date20 is for when you want to make a field be the system date. I want to change the format of a date that is being pulled from my database. Can I use the $date20 function for this? Thanks

Maybe you are looking for

  • Unable to release to accounting on VF02 - Inconsistency on posting tables

    Hi Everyone, We are unable to release a billing document on VF02. IF we check on SM13, it generates an error on FM RV_INVOICE_POST. Error details is "V2 030: Inconsistency in the posting tables for document XXXXXXXX" We have checked the ABAP editor b

  • I'm getting "the disk is too slow (prepare)" message

    I'm getting "the disk is too slow (prepare)" message when trying to do literally anything in garageband right now, even with all other programs shut down, correct energy saver settings, and only one audio track in garageband. Everything else on my ma

  • MIME Content Type in HTTP Headers - They don't exist for TIFF images

    Hello, I think this may be a bug... In an effort to stop client browsers from attempting to render TIF images served up from UCM 11g, I would like to change the MIME Typte to: application/octet-stream Supremely, a browser would see this in the HTTP h

  • Lion OS X Security & Stability Questions

    Hi, My mac was hacked before and somehow they had remote access to my macbook pro. I was using snow leopard. I have Lion OS X now,but I am seeing the rainbow wheel (busy) too much. The kernel_task is using 508MB out of 4GB while I am only using Chrom

  • Illustrator cc crashes a lot

    what can i do to stop illustrator from crashing all the time. i lost a lot of files please help me