Date and timestamp code

Hi Experts,
I've a table which contains date and timestamp in single field. Now I need to do look up on this table.
But this table can contain multiple records on same day.  I need to take record which has lower data and timestamp. How can I write a code to select lower date and stamp if multiple records exists. Any sample code. advance thank you very much.

data: begin of itab occurs 0,
          date like sy-datum.
          end if itab.
data: timestamp(14),
         zdate like sy-datum.
select time from "ur table name"  into ztimestamp.
     zdate = ztimestamp(8).
append ztable to itab.
endselect.
sort itab ascending.
read table itab index 1.
write:/ itab-date "it would be ur lowest date

Similar Messages

  • How to validate date and timestamp format? Please help!

    Hi experts,
       I have a input field "receipt_date" with is of char20 type. It contains date and timestamp value like 20090429T054509.000Z
       In my ABAP code I want to validate if "receipt_date" value is in the format YYYYMMDDTHHMMSS.MMMZ. If not then display error message. How can do this validation? Is there any existing function module that does this kind of validation? Please help!
    Thanks & Regards
    Gopal

    Hi Gopal,
    Can you check whether the FM CACS_TIMESTAMP_GET_DATE is available in XApps? If yes, use this to identify a valid timestamp.
    Sample code:
        CALL FUNCTION 'CACS_TIMESTAMP_GET_DATE'
          EXPORTING
            i_timestamp = lv_stamp
          IMPORTING
            e_date      = lv_datum
            e_time      = lv_time.
    Hope this helps! Do let me know if you need anything else!!
    Cheers,
    Shailesh.
    Always provide feedback for helpful answers

  • DATE and TIMESTAMP problem - fixable with 11.1 JDBC Driver?

    I'm adding some queries to an older part of our code base and while reading through the documentation for one of the classes I found that we weren't using our normal Hibernate queries because we needed to ensure that we weren't sending Timestamps to Oracle. Apparently the Timestamp would be converted to a Date because the column in the database was of type DATE. This was causing problems because the DATE column's index was being ignored and the table contains millions of records.
    The Oracle FAQ seems to indicate that this has been fixed in the 11.1 JDBC drivers. I know that I can use 11.1 JDBC drivers with a 10.2.0 database, but will it use the new 11.1 mappings for DATE and TIMESTAMP or the old 10.2.0 mappings? Oracle FAQ page: http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#08_01

    Oracle FAQ page: http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#08_01
    Well obviously that was really stupid.
    I'm adding some queries to an older part of our code base and while reading through the documentation for one of the classes I found that we weren't using our normal Hibernate queries because we needed to ensure that we weren't sending Timestamps to Oracle. Apparently the Timestamp would be converted to a Date because the column in the database was of type DATE. This was causing problems because the DATE column's index was being ignored and the table contains millions of records.
    Not sure I follow that logic.
    If the value was going into the database then it would update the index.
    From that only one of the following could be true.
    1. It wasn't going into the database.
    2. It was being truncated to a date.
    The Oracle FAQ seems to indicate that this has been fixed in the 11.1 JDBC drivers. I know that I can use 11.1 JDBC drivers with a 10.2.0 database, but will it use the new 11.1 mappings for DATE and TIMESTAMP or the old 10.2.0 mappings? I would agree with your interpretation of the FAQ.
    And I would then follow it up by testing both with the old driver and the new.

  • Timezone effects on Date and Timestamp fields in af:query component

    Hello,
    I'm working on an ADF application where time zone is configured as follows:
    * Dynamic View Layer time zone is configured in trinidad-config.xml file and bound to a session scoped value:
    <trinidad-config>
      <skin-family>fusionFx</skin-family>
      <time-zone>#{sessionScope.tz}</time-zone>
    </trinidad-config>* ADF BC time zone is configured in adf-config.xml file and bound to View Layer time zone:
    <adf-config>
      <user-time-zone-config xmlns="http://xmlns.oracle.com/adf/usertimezone/config">
        <user-timezone expression="#{adfFacesContext.timeZone.ID}"/>
      </user-time-zone-config>
    </adf-config>The problem here is that Dates and Timestamp values work as expected all over the application except for the af:query component. When displayed as af:inputDate in af:form, Dates and Timestamp values are NOT getting converted to the time zone (TZ) configured in trinidad-config.xml file, whereas TimestampTz and TimestampLtz are. However, when displayed in af:query component, Dates and Timestamp values are automatically converted to View Layer TZ after a search has been performed.
    For example, say View Layer TZ = US/Pacific and we enter 01/jun/2011 as a search criteria of type Date and then click on the Search button. The displayed value automatically changes to 25/nov/2011, that is, it gets converted to the WLS JVM time zone, which is set to Europe/London.
    Is conversion of Date and Timestamps in af:query component the expected behaviour or could this be a bug?
    Is there any way to avoid this conversion?
    Thanks in advance
    Version:
    ADF Business Components 11.1.1.59.23
    Java(TM) Platform 1.6.0_21
    Oracle IDE 11.1.1.4.37.59.23
    PMD JDeveloper Extension 4.2.5.3.0
    Repost on 26-nov-2011 9:29
    Repost on 28-nov-2011 15:10
    Edited by: Barbara Gelabert on 26-nov-2011 9:29
    Edited by: Barbara Gelabert on 28-nov-2011 15:10

    Hi,
    Thanks for your reply. This certainly seems promising. However, I am getting a connection error now.
    The following...
    jar_loaded = require 'ojdbc14.jar'
    puts "Oracle jar loaded? #{jar_loaded}"
    puts "Starting active record"
    require 'rubygems'
    gem 'activerecord'
    gem 'activerecord-oracle_enhanced-adapter'
    require 'activerecord'
    puts "Connecting to MXGN"
    ActiveRecord::Base.establish_connection(
    :adapter => 'oracle_enhanced',
    :host => 'THEHOST',
    :port => '1550',
    :database => 'THEDB',
    :username => 'THEUSER',
    :password => 'THEPASSWORD'
    ... produces
    Oracle jar loaded? true
    Starting active record
    Connecting to MXGN
    ERROR: ActiveRecord oracle_enhanced adapter could not load Oracle JDBC driver. Please install ojdbc14.jar library.
    ERROR: ActiveRecord oracle_enhanced adapter could not load Oracle JDBC driver. Please install ojdbc14.jar library.
    C:/jruby/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in `establish_connection': Please install the oracle_enhanced adapter: `gem install activerecord-oracle_enhanced-adapter` (LoadError) (RuntimeError)
    from H:\sandbox\DBPlay\lib\main_enhanced.rb:12
    I'm confused. Am I missing the driver, or have I failed to setup the enhanced Oracle adapter?
    I have tried moving the jar to $JRUBY_HOME/lib too, but the result was the same.
    All help would be greatly appreciated.
    Many Thanks
    Adrian

  • Production Order Change Date and Timestamp

    Hi, While trying to change the quantity and date of a production order I want to capture the date and timestamp of the change time.
    Please let me know which table or function module can be used for this. Thanks.

    Check AUFK-->AEDAT
    Regards
    AM

  • Have not purchased music for 10 months, in the meantime card has expired, which has £1.74 in credit on it, tried to change card details to current last 4 numbers/expiry date and security code but keeps on rejecting and brings back old card details

    Have not purchased music for 10 months, in the meantime card has expired, which has £1.74 in credit on it, tried to change card details to current last 4 numbers/expiry date and security code but keeps on rejecting and brings back old card details

    Try here >  iTunes Store: My credit card's security code or zip code does not match my bank's records

  • Date and Timestamp not updating

    Following on from my previous posts, the date and timestamp of updated files are not being updated in RoboSource Control, i.e. the Modified column in the RoboSource Control Explorer. However, it looks like changes are being stored on the server when topics are checked in, as I can right-click a file in source control that I have changed, choose View, and see the amendments in the HTML.
    Basically, this means that source control isn't recognising that files have changed and therefore when someone tries to get the latest version it doesn’t think there is one because the date and time are the same as previous version.
    Has anyone experienced this behaviour before or know why the Modified column has suddenly stopped being updated?
    Thanks
    Jonathan

    After some digging and random Googling the following article seems to have fixed my issue .
    It seems that if you are running RoboSource Control on 64-bit machines, there are problems with checking in files.
    http://helpx.adobe.com/robohelp/kb/cant-check-files-robosource-control.html.

  • Getting current date and timestamp for timezone

    I am getting the current date and timestamp using
    Date d = new Date();
    On the platform I'm using it is returning it in GMT time.
    I want to convert this into Eastern Time Zone for United Status.

    java.util.Date objects contain a count of milliseconds since the "epoch", which happens to be midnight, Jan 1 1970 GMT. However, they aren't intrinsically "in" any timezone.
    If you simply call Date.toString(), you'll get the date formatted for the current locale, including timezone.
    If you want a different format, you can use the DateFormat or SimpleDateFormat classes (recommended), or use Calendar to pull the various date components out. You have to physically set the timezone for each of these.
    To get a list of timezones supported by your machine, you can run this program:
    import java.util.Arrays;
    import java.util.TimeZone;
    public class TZDump
        public static void main(String[] argv)
        throws Exception
            String[] zones = TimeZone.getAvailableIDs();
            Arrays.sort(zones);
            for (int ii = 0 ; ii < zones.length ; ii++)
                System.out.println(zones[ii]);
    }And, here's a program that lets you compare the same date in different timezones:
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import java.util.TimeZone;
    public class TZDemo
        public static void main(String[] argv)
        throws Exception
            SimpleDateFormat fmt = new SimpleDateFormat("MM/dd/yy HH:mm:ss");
            Date now = new Date();
            System.out.println("Default TZ = " + fmt.format(now));
            String[] zones = new String[] { "EST", "EST5EDT", "PST"};
            for (int ii = 0 ; ii < zones.length ; ii++)
                fmt.setTimeZone(TimeZone.getTimeZone(zones[ii]));
                System.out.println("EST        = " + fmt.format(now));
    }

  • Reading Dates and Timestamps created by PL/SQL

    Hello,
    This is probably a FAQ (or stating the obvious) but I want to make sure I've got the right idea about things...
    I recently noticed that our Java app reads dates/timestamps incorrectly from the database. Any date set using 'SYSDATE' in PL/SQL is an hour out when read by Java. This is because we are now in BST and the object read back by the JDBC driver thinks the timezone is GMT.
    From reading around it seems that the DATE and TIMESTAMP types in Oracle don't persist timezone information. Fair enough, but to me this makes it dangerous to use SYSDATE at all in PL/SQL procedures.
    Previously I've never relied on the database itself to generate timestamps so dates have always been stored as UTC. I'm currently using SYS_EXTRACT_UTC(SYSTIMESTAMP) when inserting data in to tables and basically wondering if this is the common way of achieving accuracy.
    (using types such as "TIMESTAMP WITH LOCAL TIME ZONE" seem to have their own annoyances in JDBC so I've opted to avoid those)
    Thanks.

    Tom,
    This may be helpful...
    http://www.javaworld.com/javaworld/jw-10-2003/jw-1003-time.html
    Good Luck,
    Avi.

  • How to view both real data and timestamp informatio​n in TDM data viewer?

    Attached, I have a VI that uses NI-Scope (NI-5122) to digitize and store data.  I have added some TDMS functions in order to save waveform data in binary format ( our acquisition time is around 3 hours and the files become very large)  As you can see, I am using TDM file viewer to view the data, the problem I am having is that I can only see the voltages and not time stamps.  I am interested in viewing and analyzing timestamped data.  I do see that the graph contains both voltages and timestamps and idealy I would like to see both in the value tab.
    Please let me know what is the best way to see both sets of data. 
    Thanks!
    Attachments:
    niScopeFetchWDT_TDM1.vi ‏55 KB

    The TDMS file does preserve the timing information for a waveform, you can see it if you go to the 'Properties' tab.  The attributes are there to calculate the waveform timestamp data, however, it does not look like the code behind the TDMS file viewer supports displaying the timestamp values in a column on the 'Values' tab.  This seems like a good case for filing a product suggestion.  As for a work-around, if you are set on using a TDMS file and viewing the timing information you would require a custom version of a TDMS file viewer.
    -Bob
    -Bob

  • Create New Value from Date and Timestamp

    I have a date column and a timestamp column. I want to create a timestamp from the date portion of the date column and the time portion of the timestamp column. This is the pseudocode:
    select timestamp( date_portion(date_col), time_portion(timestamp_col) ) as new_timestamp from table
    Please show me how to write the Oracle SQL for best performance.

    You can do this:
    with test as (
       select
       to_date('2011-10-14 11:00:00','YYYY-MM-DD HH24:MI:SS') date_col,
       to_timestamp('2011-10-13 20:20:20.123456','YYYY-MM-DD HH24:MI:SS.FF') timestamp_col
       from dual
    -- end of test data
    select
    to_timestamp(
       to_char(date_col,'YYYY-MM-DD')
       ||' '||
       to_char(timestamp_col,'HH24:MI:SS.FF'),
       'YYYY-MM-DD HH24:MI:SS.FF'
    ) new_timestamp
    from test
    ;This takes the date-part of date_col (2011-10-14), concatenates with the time-part of timestamp_col and converts to a timestamp.
    (But it would have been easier simply not to have the date column and just let the timestamp column have both date and time information :-) )

  • Date and timestamp issue please help

    In the following creation_date is DATE datatype.
    creation_time is VARCHAR2 having only MI:SS (16:02).
    :DATE_LAST_CHECKED is VARCHAR2 having string without time.
    If that be the case how can I compare these 2 statements with the time. I need to compare with timestamp.
    Please let me know.
    TO_DATE(TO_CHAR(TRUNC(csa.CREATION_DATE),'DD-MON-YYYY') ||' ' || csa.creation_time,'DD-MON-YYYY HH:MI pm')
    = TO_DATE(NVL(:DATE_LAST_CHECKED,SYSDATE-5),'DD-MON-YYYY HH24:MI:SS')

    I won't even ask why creation_date and creation_time are split out into separate columns. The DATE datatype supports both and you will have to code conversions like this all over the place.
    to_date(to_char(csa.creation_date, 'mm/dd/yyyy') || csa.creation_time, 'mm/dd/yyyyhh:mi pm')
    = nvl(to_date(:date_last_checked, 'mm/dd/yyyy'), trunc(sysdate - 5))

  • Ship to party master data  and company code data

    Hi,
    As we know that at the time of creating sold to prty master data we have to maintain Compant code data. But do we have to maintain Company code data if we create new Ship to party and Payer Master data.
    Regards
    jyoti

    Hi
    If you are creating these customers centrally, i suppose you should maintain the company code data.
    Regards

  • HT1918 revised credit card expiry date not updating on my account, warning box says card has expired even after i change the details and security code. anyone know how to correct this?

    has anyone experienced this i want to update my card details on my account but it says card expired even when i put in the new expiry date and security codes.

    Reset the device:
    Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears.
    Then edit your payment details.
    If that doesn't help, tap Settings > General > Reset > Reset All Settings. Then try again.
    iTunes Store: Changing account information
    iTunes Store: Accepted forms of payment

  • [iOS4] CMDeviceMotion and timestamp problem

    Hi,
    Excuse my English as it isn't my primary language.
    I hava a problem using an instance of CMDeviceMotion. I need data from both the gyro and accelerometer and the frequency of sample is set at the maximum, 100.
    I also need the timestamp at which the sample was taken. However, at the beginning the timestamp doesn't change even if the acceleration and gyro change. I got something like that :
    0.003779 -0.050910 0.001185 933.604339
    0.035029 -0.042457 0.019893 933.604339
    0.062266 -0.009147 0.084819 933.604339
    0.069300 0.012292 0.092631 933.604339
    0.047862 0.018517 0.091456 933.604339
    0.035304 0.029885 0.084575 933.604339
    0.032496 0.039498 0.083583 933.604339
    We have acceleration.x, .y, .z and the timestamp. As you can see the timestamp doesn't change for about 60 upgrades ~6 seconds.
    Besides, when it finally starts upgrading, it sometimes sample twice the accelreation/gyro at the same timestamp :
    0.115215 0.005342 -0.051157 1385.964002
    *0.120561 0.019797 -0.054112 1385.977830*
    *0.122637 0.031470 -0.051182 1385.977830*
    0.113840 0.042271 -0.045493 1385.992829
    Here is my code :
    In the viewDidLoad method :
    motionManager = [[CMMotionManager alloc] init];
    motionManager.deviceMotionUpdateInterval = 0.01;
    frequence = 100;
    Then I have a method invoked by a button :
    [motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue currentQueue]
    withHandler: ^(CMDeviceMotion *motionData, NSError *error)
    CMRotationRate rotation = motionData.rotationRate;
    CMAcceleration acceleration = motionData.userAcceleration;
    NSLog(@"rotation rate = [%f, %f, %f, %f]", rotation.x, rotation.y, rotation.z, motionData.timestamp);
    NSLog(@"acceleration rate = [%f, %f, %f, %f]", acceleration.x, acceleration.y, acceleration.z, motionData.timestamp);
    Any help appreciated,
    Thanks for your time
    Loïs

    Oracle FAQ page: http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#08_01
    Well obviously that was really stupid.
    I'm adding some queries to an older part of our code base and while reading through the documentation for one of the classes I found that we weren't using our normal Hibernate queries because we needed to ensure that we weren't sending Timestamps to Oracle. Apparently the Timestamp would be converted to a Date because the column in the database was of type DATE. This was causing problems because the DATE column's index was being ignored and the table contains millions of records.
    Not sure I follow that logic.
    If the value was going into the database then it would update the index.
    From that only one of the following could be true.
    1. It wasn't going into the database.
    2. It was being truncated to a date.
    The Oracle FAQ seems to indicate that this has been fixed in the 11.1 JDBC drivers. I know that I can use 11.1 JDBC drivers with a 10.2.0 database, but will it use the new 11.1 mappings for DATE and TIMESTAMP or the old 10.2.0 mappings? I would agree with your interpretation of the FAQ.
    And I would then follow it up by testing both with the old driver and the new.

Maybe you are looking for