How to cut down date varchar field

All
We have the following in one of our tables, '2006-03-06 16:19:56'
Now i would like to be able to do something like this
select userid, to_char(logindate, 'YYYY-MM-DD HH24') from tablename, but i can't seem to cut it down, could someone give me a quick once over on the to_char function, and if i should be using it for this.

You can cut it dow like that. See below:
SQL> select to_char(sysdate, 'YYYY-MM-DD HH24') from dual
  2  /
TO_CHAR(SYSDA
2006-03-07 09
SQL> The problem with your data is first you convert logindate to date. Something like this:
select userid, to_char(to_date(logindate, 'YYYY-MM-DD HH24:MI:SS'), 'YYYY-MM-DD HH24')
      from tablename;You can as well use
select userid, substr(logindate, 1,13)
      from tablename;Cheers
Sarma.

Similar Messages

  • How to cut off data use on a line in a family share plan?

    Is there a way to cut off data useage on one line in a family share plan? I have one person that is going over and want to simply cut off the data use after she reaches say 110% of her use in the billing cycle.

    I agree get Family Base and charge then the extra $5 it will cost since that person doesn't seem to understand the concept of SHARING. Or up the data plan and charge the extra to them and tell them since you had to increase the data plan because them they can pay the extra mount.

  • How to pass the  data to field of  table.

    I want to pass the data to the fields of table. I want it with codes.

    Hi sindu,
    First of all Welcome to SCN.
    I hope you need to Read the [Rules of Engagement|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement] before posting more.
    There are lots of resources available already here, so have a habit of searching before posting a question.
    Also while posting a question ensure that you include the following details;
    1) what is your requirement?
    2) How you are doing it?
    3) Where are you struck?
    4) What have you done to overcome the problem?
    5) The part of code that needs troubleshooting.
    Regards
    Karthik D

  • How to autofill a date/time field on a print event?

    I am trying to have a read only field auto populate the date and time when a form is printed.
    How do I set up a script to initiate on a prePrint event?  I am very new to trying to script my own events.
    Thank you for your help!
    S.

    that worked thanks a lot,
    the values are inserted into the database now but i still get an error
    SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
    but the values are inserted....a bit confused about that any reason why that would happen?

  • How to edit a data merge field in a 'header'?

    Hi All,
    I'm trying to figure out how to edit the green bar so I can replace <<Expertise>>-<<Expertise>> with a different field from my excel data source. I want to replace it with the Category field in the Data Merge box but I cannot seem to edit that green bar.
    Help! Thanks in advance,
    Mark

    Actually you were right, it was being inherited by the master page. And the 'live' page we were working on was unable to delete it. When I went to the master page, I deleted the << >> and it deleted it from the live page.
    Now when I put in the <<category>> on the master page, it shows on the live page. For some reason my data rows are not displaying multiple records to a page now (shows only 1 per page so I've got 117 pages!), but ill try to figure out what happened.
    Thanks!!

  • How to populate the data in fields if we tab out at one field

    Hi Gurus,
    I am new to OAF Technology and I've new requirement in custom OAF page.
    We have 12 fields like ID, Fname, Lname, Age, Address, Tphone etc..
    If we enter ID in message text input field box and tab out, then it should populate all the remaining fields data by default.
    Could anyone help me regarding this requirement?
    Thanks in Advance
    Sruthi

    Hi,
    Sruthi wrote:
    I am new to OAF Technology and I've new requirement in custom OAF page.
    We have 12 fields like ID, Fname, Lname, Age, Address, Tphone etc..
    If we enter ID in message text input field box and tab out, then it should populate all the remaining fields data by default.
    Could anyone help me regarding this requirement?---MessageTextInput filed set Action property:FirePartialAction and Event:TextInput
    ---Get the Event in co PFR
    if("TextInput".equals(pageContext.getParameter(EVENT_PARAM)))
    AM.setDafultValue();
    ---Write a method in AM
    public void setDafultValue()
    VOImpl vo=getVO1();
    if(vo!= null)
    vo.getCurrentRow().setAttribute("Number1","DefaultValue1");
    vo.getCurrentRow().setAttribute("Number2","DefaultValue2");
    ---Like this u can set default value when tab out.
    Regards
    Meher Irk

  • How to use PIVOT for varchar field

    Have data (records) as such:
    Joe, Smith, PersonType1
    Joe, Smith, PersonType2
    Joe, Smith, PersonType3
    Joe, Smith, PersonType4
    Joe, Smith, PersonType5
    However need to present it within ONE row per/Person with the PersonType in columns within this same row:
    Joe, Smith, PersonType1, PersonType2, PersonType3, PersonType4, PersonType5
    Please how would I write my sql to get this results..
    Help greatly appreciated...
    Thanks
    Mijecarr

    Thank you very much for your assistance...
    Replaced your sample code with the "real" names as indicated below.  However when running the query get the following error - please any suggestion?:
    Msg 488, Level 16, State 1, Line 2
    Pivot grouping columns must be comparable. The type of column "Notes" is "text", which is not comparable.
    select
    LastName,[1]
    asContactType1,[2]
    asContactType2,[3]
    asContactType3,[4]
    asContactType4,[5]
    asContactType5
    from
    (select*,row_number()Over(PartitionbyLastName
    OrderbyLastName)rn
    fromContact)src 
    Pivot(max(UserText10)forrn
    in([1],[2],[3],[4],[5]))pvt
    Mijecarr

  • How to populate predefined data in Field

    Hi All,
    I have a requirement to populate certain value in one particular field and should be maintained by the user also from the UI. So below are the step i have followed to obtain this requirement:
    1. Created one Code list using Business configuration Object and Business configuration Set, so that it can be maintain from UI.
    Code
    Value
    1
    A
    2
    B
    3
    C
    4
    D
    2.Created one Event handler Product as below:
    3. Called on,click on one tab:
    Issue: when i click on the tab initially the pre populate Code is coming not the values although i have selected values in the property of that particular Field:
    Field
    A
    B
    C
    D
    Can you please Suggest something on this?
    Thanks & Regards,
    Malkit Singh

    Hi Malkit,
    first of all be carefull with using ruby scripts as they are not supported on iPad app.
    If I understand correctly, then you want to assign initial values when quick create is opened. If that is correct, than actually you could simply add necessary values for fields in DataModel view.
    Cheers,
    Uldis

  • How to automatically open date/time field (calendar) when end user tabs to that field

    Have two calendar fields...calendar 1 and calendar two
    Is there a way to have the calendars automatcally open when field is either clicked on or tabbed to?
    thanks

    You can try one work around:
    Add another UDF time with plain text field.
    Implement post-insert event handler to insert time value in this field. In the event handler you can write the code to put time in the format you want.
    regards,
    GP

  • How to create a Date or time field that automatically saves current date or time?

    hello,
    i want to know that how to create a Date/Time field that automatically shows current Date/Time when .pdf form is opened.
    also want to how to stop user to give input in Date/Time field
    currently im putting a Date field but it is accepting user input.
    hoping for quick response
    Thanks in advance!

    You can place the below code in the initialize event of the field to display the current date and time.
    Set the language to FormCalc.
    You can play around the formats to get the desired format of date and time.
    if($.rawValue eq null or $.rawValue eq "") then
    $.rawValue = Concat(Num2Date(Date(), "MM/DD/YYYY")," ", Num2Time(Time(), "h:MM:SS A"));
    endif
    You can not restrict the input area in Date time field instead you can validate the input while existing the field.
    (OR) set the field to either readOnly or protected mode.
    Thanks
    Srini

  • To find the date type fields in the row and validate those date fields

    TYPES : BEGIN OF TY_MARA,
              MATNR TYPE MARA-MATNR,
              ERSDA TYPE MARA-ERSDA,
              ERNAM TYPE MARA-ERNAM,
              LAEDA TYPE MARA-LAEDA,
              MTART TYPE MARA-MTART,
            END OF TY_MARA.
    DATA : it_mara TYPE STANDARD TABLE OF ty_mara,
          it_mara1 TYPE STANDARD TABLE OF ty_mara,
           wa_mara TYPE ty_mara.
    loop at it_mara into wa_mara.
      describe field wa_mara-ersda type c_data.
    if c_data eq 'D'.
      CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
        EXPORTING
          date                            = wa_mara-ersda
       EXCEPTIONS
         PLAUSIBILITY_CHECK_FAILED       = 1
         OTHERS                          = 2
      IF sy-subrc eq 0.
    wa_mara-ersda = '00000000'.
        append wa_mara to it_mara1.
        write :wa_mara-matnr,wa_mara-ersda.
        else.
            wa_mara-ersda = '00000000'.
        append wa_mara to it_mara1.
        write :wa_mara-matnr,wa_mara-ersda.
      ENDIF.
      endif.
      endloop.
    This issue regarding how to find the date type fields in the row and validate those date fields.If its not a valid date ,i have to assign initial value to that.
    I've tried that for single field using describe field.Please help me do that for all fields.

    Hi Sam,
     I believe we had discussed the same issue in the below thread. Can you please refer the below one?
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/d93e16ff-c123-4b36-b60b-60ccd34f6ca7/calculate-time-differences-in-infopath?forum=sharepointcustomizationprevious
    If it's not helping you please let us know
    Sekar - Our life is short, so help others to grow
    Whenever you see a reply and if you think is helpful, click "Vote As Helpful"! And whenever
    you see a reply being an answer to the question of the thread, click "Mark As Answer

  • Cut down on Rendering time

    Hello,
    I am looking for any tips on how to cut down on rendering time. I usually do weddings and it seems, for the ceremony portion, I have to render each cut with each transition. These are just cross dissolve transitions. I am using 3 camera's, so the footage from each one is on V1, V2 & V3. If I do a transition involving the footage on V1...that particular cut always has to be rendered...taking up time...Is there a way to get around this? Thanks in advance.

    That's because there isn't one. v1 did not have much RT capabilities. We'd need to upgrade to a newer version for more productivity. The current version with LiveType is great for event producers.

  • How to get calendar icon to show again when entering data in date/time field.

    Hello,
    First time posting on this site.  I am fairly new to using SQL Server Express.  I created a split-database in MS Access 2010 and have successfully migrated over the backend database to SQL Server Express.  When I was using the FE forms in
    Access, I use to be able to see a calendar icon where I could select the month and day in the date/time field.  
    I compiled the FE forms to binary format .accde so that I could distribute this to the users and they couldn't change my forms. After migrating the tables to SQL Server express for the BE, I am no longer able to see the calendar icon when I try to enter
    in data in the date/time field.   Same for the original .accdb file before the binary conversion to .accde.  
    How do I get the calendar icon back to show on the form when a user is entering in data?  I appreciate any assistance I can get. Thank you!
    Thai

    Hello Cheer,
    I don't believe the table changed when migrating from Access.  I had two tables before the migration, one was for the SwitchBoard Manager and the other table was for the database table.  I used the Switchboard to navigate to different menus, such
    as the Main Form, Power Form, Server Form, etc.  Let me know if I can provide any other information to help you narrow this down for me.   
    Thank you for your assistance. 
    Thai

  • Cut down Table data

    Hi
    I got one requirement to cut down one Table having 4 years worth of data. Requirement want to export only 6 month of data of same table to another database.
    The problem with this table is that.. This table is not having any "date" column_name or Data_type.
    Table structure is as ..
    "CLICK_ID" NUMBER,
    "MEMBER_ID" NUMBER,
    "LINK_ID" NUMBER,
    "CLICK_TIMESTAMP" NUMBER,
    "REMOTE_HOST" VARCHAR2(255 CHAR),
    "USER_AGENT" VARCHAR2(255 CHAR),
    "FAMILY" NUMBER,
    "AGENT" NUMBER,
    "TYPE" NUMBER,
    "COMBINED" NUMBER,
    "BUILDMODE" NUMBER,
    Please guide me how can I cutdown this table to only 6 months of data.
    I am on Oracle 10g.
    Let me know if you need more information.
    Thanks

    PK wrote:
    Hi
    I got one requirement to cut down one Table having 4 years worth of data. Requirement want to export only 6 month of data of same table to another database.
    The problem with this table is that.. This table is not having any "date" column_name or Data_type.
    Table structure is as ..
    "CLICK_ID" NUMBER,
    "MEMBER_ID" NUMBER,
    "LINK_ID" NUMBER,
    "CLICK_TIMESTAMP" NUMBER,
    "REMOTE_HOST" VARCHAR2(255 CHAR),
    "USER_AGENT" VARCHAR2(255 CHAR),
    "FAMILY" NUMBER,
    "AGENT" NUMBER,
    "TYPE" NUMBER,
    "COMBINED" NUMBER,
    "BUILDMODE" NUMBER,
    Please guide me how can I cutdown this table to only 6 months of data.
    I am on Oracle 10g.
    Let me know if you need more information.
    ThanksObviously you are going to have to decide how to identify the age of a row. WE certainly don't know your application. I do see a column CLICK_TIMESTAMP that could be promising. What is it?

  • Implemented BADI to add custom screen to VD02 - how to get data to fields?

    hi..
    i have implemented CUSTOMER_ADD_DATA and CUSTOMER_ADD_DATA_CS to add a new screen to Customer Master maintenance tcodes.
    When I run VD02 (for example), I get my button and when I click it, my new screen with new fields show up.
    I need to be able to select from a custom table based on the current KUNNR and populate those fields with data for the user.
    I created the custom screen using a Module Pool program - so this does give me PBO/PAI but I don't have access at that point to my S_KNA1 & other structure info that is contained in the BADI which I need.
    How do I pass data to those fields?
    thanks in advance.
    rp.

    At the point you are clicking 'your' button you could export the structures containing the needed data to abap memory. once in your new screen pbo you may import from abap memory.
    do make sure that your development is hit only for the document type and other usage parameters by putting enough filters before the screen call- else this can slow down quite a few things in SD.

Maybe you are looking for