conversion and the time format

Hello world

I have fields: start_date and Start_time.

Example:

Start_date: 2010-11-05
Start_time: 23:18:06.687Z

What I need, is to add 2 hours in time and change the format as HH24:MM:SS and if the new time goes beyond midnight the start_date should be updated with 1 date of.

Any ideas?

Sedso

Any ideas?

Sedso

You can use TO_DATE add 2 hours and TO_CHAR to split your date and time components.
But it's an exaggeration...

SQL> -- generating sample data:
SQL> with t as (
  2  select '2010-11-05' start_date, '23:18:06.687Z' start_time from dual
  3  )
  4  --
  5  --  actual query
  6  --
  7  select start_date
  8  ,      start_time
  9  ,      to_date(start_date||' '||substr(start_time, 1, instr(start_time, '.')-1), 'yyyy-mm-dd hh24:mi:ss') dt
 10  ,      to_char(to_date(start_date||' '||substr(start_time, 1, instr(start_time, '.')-1), 'yyyy-mm-dd hh24:mi:ss')+2/24, 'yyyy-mm-dd') new_start_date
 11  ,      to_char(to_date(start_date||' '||substr(start_time, 1, instr(start_time, '.')-1), 'yyyy-mm-dd hh24:mi:ss')+2/24, 'hh24:mi:ss') new_start_time
 12  from   t;

START_DATE START_TIME    DT                  NEW_START_ NEW_STAR
---------- ------------- ------------------- ---------- --------
2010-11-05 23:18:06.687Z 05-11-2010 23:18:06 2010-11-06 01:18:06

Tags: Database

Similar Questions

  • The time format

    Hello

    just a small comment on French and the time format: now, it is written in non-French format (0:00-12:00 a.m..) while in France, we use a time format 24 hours (0 h 00 - 24 h 00)

    Thanks for the comments. We relaierons this to our product team.

    Best,

    Socialcast VMware team

  • How display the date and the time in the taskbar on Windows 7 Home Premium 64 bit system?

    How display the date and the time in the taskbar on Windows 7 Home Premium 64 bit system?

    I already did it.  The time is displayed in the correct format, but I can't seem to view the date of

    Any other suggestions?

    Thank you

  • How can I set the time format 24 hours instead of AM/PM lightning/en? Thank you very much!

    I want to configure lightning with the time format 24 hours rather than the AM/PM format, but cannot find it in the options. Thanks for the help!

    You will need to set it for your operating system. Lightning uses the format of the OS.

  • applications are confused by changing the time format from 24 hours to 12: 00 and return!

    Hello, I accidentally changed my time format phone from 24 hours to 12 hours (am/pm) and now when I switched it back I noticed the phone time got it wrong - 12 hours of rest. I had to manually set it to something like 23 because she thought that it is 11. Now the time has come, but the apps are totally confused and they think that it is at night when it of day and vice versa! It really * beep * when you need to know quickly if a bus is coming or don't use is not some app for it.

    I tried to reinstall an application but he still thinks that it is 12 hours less (or more), then it really is.

    It's crazy because the clock widgets it's 14:26 but the weather widget it's 02:26! What can I do with it?

    Don't know how, but my time zone is wrong! LOL it's UTC-11hours. So I put it to UTC + 1 and it is right now. [Why apps showed these different times I don't know:-]

  • type conversion of numeric value in the time format

    Hi guys,.
    I have the column called need .i (time in seconds) to convert the numeric value of a column in time format HH. for example 3012 = 00: 50.12.
    How can I proceed even in the front.


    Thank you and best regards,
    Nandu

    Hi Nelly,

    Pls go through the below formula:
    This deffenitely will help you resolve the issue.

    Concat (concat (concat (concat (cast (floor ((COLUMN_NAME) / 3600) as char), ':'), cast (floor (mod ((COLUMN_NAME), 3600) / 60) as char)),': '), cast (floor (mod (mod ((COLUMN_NAME), 3600), 60)) as char))

    Thank you
    Cognet

  • When the value to display in the time format double digital indicator... Changes in value.

    Hi all

    I can't display the values that I want. I have a value double say 320 sent to a digital indicator where I edited the properties of it to display in a time format that contains only minutes and seconds as Yes, 3:20 '. Unfortunately, it takes the value and change it to another value and display that. I don't know what is the issue. If anyone knows the solution... Please post!

    There is an image attatched!

    Thank you.

    I believe only then due to the fact that when I convert a timestamp value to double as 03:20, he gave me 320. So I thought that the reverse can be trying. Should I just enter the total amount of seconds and that will show the Minuteseconds I want?

    Thanks for the quick response.

  • Change the time format in Lightroom 6 of 12 hours (AM/PM) to 24 hours

    Hello

    I wonder if someone could hel me with that?

    I can't find a way to change the format of the time preferred 12 hours to 24 hours. I use Lightroom 6 on a MacBook Pro with OS 11.1.1. I think the problem may stem from the fact that the format of the time at the time of the installation of LR6 was is 12 hours. I changed the format of the time preferred in the Finder to 24 hours, but it doesn't have an impact on the size LR6. What I have to reinstall LR for this problem or is there a way around it?

    My camera (Nikon D700) is defined with the format 24 hours and photos uploaded in own Nikon viewnx2 on my computer is in 24-hour format. When I import photos LR6, they end up with the 12-hour format.

    I expect that LR would have a panel where you can choose between 12 and setting the time 24 hours.

    Someone at - it a way to solve this problem?

    Kolbein

    Clearly there is something different between your configuration and mine.

    In which country did you buy and install Lightroom?

    Please post screenshots of these windows in system preferences:

    Speaking area &

    Language & region > advanced > Dates

    Language & region > advanced > times

  • Field validation text for the time format

    Hi all

    I have been breaking my head for almost 2 weeks, but am not able to figure it out... Please help me solve the riddle... here, it will:

    In a text field, I want to perform an operation in the following way:

    > a text default to 00:00:00 is defined at the moment as the text field is for the moment and the length in characters of the field is 8.

    > if the cursor is in position 0 (zero) and if I press a number of key it should replace the value of the 0 position and move the cursor to the next position.

    for example: 00:00:00

    20:00

    explanation : now the cursor is in position 0 and I press the 2 key it should replace the value 0 in position 0 and den move the cursor on the position 1 ie. next position...

    When I press a button not digital it shouldn't replace the value, but the slider should move to the next position.

    This seems to work ok. You need to test more, however. I've added a few properties for the hours, minutes and seconds as well.

    import java.util.regex.Pattern;
    
    import javafx.application.Application;
    import javafx.beans.binding.Bindings;
    import javafx.beans.binding.IntegerBinding;
    import javafx.beans.property.ReadOnlyIntegerProperty;
    import javafx.beans.property.ReadOnlyIntegerWrapper;
    import javafx.geometry.Insets;
    import javafx.scene.Scene;
    import javafx.scene.control.IndexRange;
    import javafx.scene.control.Label;
    import javafx.scene.control.TextField;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    
    public class TimeTextFieldTest extends Application {
    
     @Override
      public void start(Stage primaryStage) {
      VBox root = new VBox(5);
      root.setPadding(new Insets(5));
      Label hrLabel = new Label();
      Label minLabel = new Label();
      Label secLabel = new Label();
      TimeTextField timeTextField = new TimeTextField();
      hrLabel.textProperty().bind(Bindings.format("Hours: %d", timeTextField.hoursProperty()));
      minLabel.textProperty().bind(Bindings.format("Minutes: %d", timeTextField.minutesProperty()));
      secLabel.textProperty().bind(Bindings.format("Seconds: %d", timeTextField.secondsProperty()));
    
      root.getChildren().addAll(timeTextField, hrLabel, minLabel, secLabel);
      Scene scene = new Scene(root);
      primaryStage.setScene(scene);
      primaryStage.show();
      }
    
      public static void main(String[] args) {
      launch(args);
    
      }
    
      public static class TimeTextField extends TextField {
    
        enum Unit {HOURS, MINUTES, SECONDS};
    
        private final Pattern timePattern ;
        private final ReadOnlyIntegerWrapper hours ;
        private final ReadOnlyIntegerWrapper minutes ;
        private final ReadOnlyIntegerWrapper seconds ;
    
        public TimeTextField() {
          this("00:00:00");
        }
        public TimeTextField(String time) {
          super(time);
          timePattern = Pattern.compile("\\d\\d:\\d\\d:\\d\\d");
          if (! validate(time)) {
            throw new IllegalArgumentException("Invalid time: "+time);
          }
          hours = new ReadOnlyIntegerWrapper(this, "hours");
          minutes = new ReadOnlyIntegerWrapper(this, "minutes");
          seconds = new ReadOnlyIntegerWrapper(this, "seconds");
          hours.bind(new TimeTextField.TimeUnitBinding(Unit.HOURS));
          minutes.bind(new TimeTextField.TimeUnitBinding(Unit.MINUTES));
          seconds.bind(new TimeTextField.TimeUnitBinding(Unit.SECONDS));
        }
    
        public ReadOnlyIntegerProperty hoursProperty() {
          return hours.getReadOnlyProperty();
        }
    
        public int getHours() {
          return hours.get() ;
        }
    
        public ReadOnlyIntegerProperty minutesProperty() {
          return minutes.getReadOnlyProperty();
        }
    
        public int getMinutes() {
          return minutes.get();
        }
    
        public ReadOnlyIntegerProperty secondsProperty() {
          return seconds.getReadOnlyProperty();
        }
    
        public int getSeconds() {
          return seconds.get();
        }
    
        @Override
        public void appendText(String text) {
          // Ignore this. Our text is always 8 characters long, we cannot append anything
        }
    
        @Override
        public boolean deleteNextChar() {
    
          boolean success = false ;
    
          // If there's a selection, delete it:
          final IndexRange selection = getSelection();
          if (selection.getLength()>0) {
            int selectionEnd = selection.getEnd();
            this.deleteText(selection);
            this.positionCaret(selectionEnd);
            success = true ;
          } else {
            // If the caret preceeds a digit, replace that digit with a zero and move the caret forward. Else just move the caret forward.
          int caret = this.getCaretPosition();
          if (caret % 3 != 2) { // not preceeding a colon
            String currentText = this.getText();
            setText(currentText.substring(0, caret) + "0" + currentText.substring(caret+1));
            success = true ;
          }
          this.positionCaret(Math.min(caret+1, this.getText().length()));
          }
          return success ;
        }
    
        @Override
        public boolean deletePreviousChar() {
    
          boolean success = false ;
    
          // If there's a selection, delete it:
          final IndexRange selection = getSelection();
          if (selection.getLength()>0) {
            int selectionStart = selection.getStart();
            this.deleteText(selection);
            this.positionCaret(selectionStart);
            success = true ;
          } else {
          // If the caret is after a digit, replace that digit with a zero and move the caret backward. Else just move the caret back.
            int caret = this.getCaretPosition();
            if (caret % 3 != 0) { // not following a colon
              String currentText = this.getText();
              setText(currentText.substring(0, caret-1) + "0" + currentText.substring(caret));
              success = true ;
            }
            this.positionCaret(Math.max(caret-1, 0));
          }
          return success ;
        }
    
        @Override
        public void deleteText(IndexRange range) {
          this.deleteText(range.getStart(), range.getEnd());
        }
    
        @Override
        public void deleteText(int begin, int end) {
          // Replace all digits in the given range with zero:
          StringBuilder builder = new StringBuilder(this.getText());
          for (int c = begin; c 23) {
              return false ;
            }
            if (mins < 0 || mins > 59) {
              return false ;
            }
            if (secs < 0 || secs > 59) {
              return false ;
            }
            return true ;
          } catch (NumberFormatException nfe) {
            // regex matching should assure we never reach this catch block
            assert false ;
            return false ;
          }
        }
    
        private final class TimeUnitBinding extends IntegerBinding {
    
          final Unit unit ;
          TimeUnitBinding(Unit unit) {
            this.bind(textProperty());
            this.unit = unit ;
          }
          @Override
          protected int computeValue() {
            // Crazy enum magic
            String token = getText().split(":")[unit.ordinal()];
            return Integer.parseInt(token);
          }
    
        }
    
      }
    }
    
  • Can you help me to get the time format to match the XML dateTime?

    XML has a dateTime format that looks like this:

    2002-10 - 10T 12: 00:00 - 05:00

    and Im using the XMLElement() functions in some queries to produce an xml document however it truncates the portions of time stored data is just MM/DD/YYYY.

    I would use a to_char function but I don't know what date format in Oracle to use to match the portion of zone at the end (-05:00) and how to make so that it can accept as 't' in there as a separator, as defined in the XML schema specification:

    http://www.w3.org/TR/xmlschema-2/

    Anyone know?

    Hello

    Trant says:
    XML has a dateTime format that looks like this:

    2002-10 - 10T 12: 00:00 - 05:00

    and Im using the XMLElement() functions in some queries to produce an xml document however it truncates the portions of time stored data is just MM/DD/YYYY.

    I would use a to_char function but I don't know what date format in Oracle to use to match the portion of zone at the end (-05:00) and how to make so that it can accept as 't' in there as a separator, as defined in the XML schema specification:

    http://www.w3.org/TR/xmlschema-2/

    Anyone know?

    Try something like

    SELECT     TO_CHAR ( SYSTIMESTAMP
              , 'YYYY-MM-DD"T"HH24:MI:SSTZH:TZM'
              )
    FROM     dual;
    

    The sample output:

    2011-07-25T15:50:12-04:00
    

    TO_CHAR function is described in the SQL language reference manual:
    http://download.Oracle.com/docs/CD/B28359_01/server.111/b28286/sql_elements004.htm#sthref396
    Search for "Date Format models" in the index.

    Put the mat (that is, fixed) text, for example the letter 'T', in the output, include it in double - quotes.
    TZH is the hours and TZM time zone format specifier is synonymous of zone Minutes.

  • help me create a column with the time format

    Hi all

    Please help me find the query to create a table with 3 columns and insert the following data

    ENTITYID | CHGDATE | CHGTIME

    ======= ==================== ========

    4214984 | 2 OCTOBER 06 12.00.00.000000 AM | 07:23:57

    4214985 | 12.00.00.000000 11-SEP-08 AM | 10:52:19

    and update of the first line of the above table as follows
    ---------------------
    4214984 | 2 OCTOBER 06 07.23.57.000000 AM | 07:23:57
    ------------------------
    you will need to update the CHGDATE column with the time of the CHGTIME column.

    Sorry, we need a new format around the to_date

    select to_date(to_char(chgdate, 'mm/dd/yyyy') || ' ' || to_char(chgtime, 'hh24:mi:ss'), 'mm/dd/yyyy hh24:mi:ss') from etime3;
    

    This should telll Oracle to the format of the generated string. If this isn't the case, run select with the to_char two as separate columns to see that get us the data that we expect.

  • Use 6 s more: iPhone battery is not displayed and the time standby and use are the same, even I do not use it

    Hello. I just bought an Iphone 6s MORE and just updated to iOS 9.2 and I had this problem with applications that consume my battery is to say the list of applications that drain the battery does NOT appear when I click on settings > battery. And also I meet another problem that is my standby and usage time appeared at the same time even if I SLEEP there during the entire period. Someone of you this problem? If yes kindly share here how you can solve the problem

    Force restart the phone now sleep and home for 10 seconds, button until the Apple logo comes back again.

    You won't lose data, but which can cure some problems after installing new software.

    The same use and waiting time is a sign for some applications, always running in the background, even when the phone is in standby. Restart will force close those apps.

    The list of applications appears only when you used some applications for some time.

  • How to save the book Photo and the current format before you create a new

    I want to discover a new book and format using the same photos (than my current one) - I'll lose the current if I choose the size and the Format change?

    I lose the current if I choose the size and the Format change?

    Yes. The old book will be lost.

    Make a duplicate of your book and try the other themes on the copy.

    Switch to another theme can reformat a few pages, this text may be lost.

    CTRL-click on the book in the library of Inspector in the sidebar and click "duplicate".

  • Pulse ultrasonic 40 kHz and the time before receiving the pulse.

    Hello

    I developed the following circuits:

    TX: a Circuit that generates a 40 kHz of frequency using a LM555, the LM555 is connected to a gate AND who, when you use the test on MyDAQ Panel (6216) I put cntr0 and set it to the detection of edge I can count the number of detections of edge when I activate the port up and when I turn it on it low stop recording of the counties.

    Rx: Reception Circuit contains an op amp that is introduced in a LM567CN tone decoder which is set at 40 Khz. when the receiver PLL circuit locks on the 40 kHz signal switches LM567 pin 8 output ground.

    Question: I am NEITHER very new and ask yourself where the starting point would be to create a VI that will trigger the Tx circuit, and then measures the time required for the circuit of Rx to receive the signal, this intitial will carried out through the air and then I want to move it through a meduim such as water. Someone at - he tried or seen anything that would be useful to create a vi that correspond to this.

    Any help would be greatly appericated.

    Phil

    Using a myDAQ or a 6216?  You mentioned the two... I'll assume 6216:

    You'll want a task of separating two edgeand also a task of digital output.

    The digital output control signal enable for the LM555.  Connect from the digital output line at your door AND as well as a PFI lines on the 6216 (this will be the "first" edge).  Connect pin 8 of the LM567 to a different line of the PFI on the 6216 (the 'second' edge). You can configure the polarity up/down via the Create channel VI (looks like your second advantage is going to be 'falling').

    Programming would be as follows (in order):

    1 configure the tasks as shown in the related examples (i.e. channel to create / configure synchronization).

    2. start the task of digital output.

    3. write the 'low' digital output to ensure that it is initialized.

    4. start the task of separation on both sides (it should be buffered as in the example linked even if you are only reading a sample).

    5 write the digital output 'high '.

    6. reading (a sample) the task of separation on both sides.  Specify a time for read long enough to ensure that the falling edge is considered.

    7. write the 'low' digital output (assuming that you want to disable the Tx when you are finished with the test)

    8. stop and disable the two tasks.

    The measured result will be a 12.5 ns resolution using the time base 80 MHz by default on the 6216.

    Best regards

  • VISA series and the time elapsed in a timeout

    Hi people,

    Still new to LabView, please bear with me...

    I have a VI that is sitting and wait a certain string of characters arrive on the port series, but I need a timeout that is not based on the VISA expiration time.

    I expect a bunch of text via the serial port for ~ 45 seconds, then my input string will compare the matched string and move to the next VI.

    In case of no matching strings, the serial port can continue to send data serially, or may be inactive (no-determinisitic because this test is to see if a computer system started successfully). But once the VI starts, I should have 60 seconds to find the match, or set the bool 'selection' to fail.

    I tried to put my loop of time inside the main loop, outside, with or without SRs, and now I am at a loss. I looked at the VI has highlighted and the serial activity is active the timer has expired for 60 seconds.

    Please take a look at the joint and thanks for taking a peek at this post.

    I'm not entirely sure I understand what you are trying to accomplish. However, here are my thoughts:

    1. You have attached the VI waits 60 seconds before checking the serial port for waiting bytes ONCE then read bytes if available and leave immediately. It's because you have while the loop around the elapsed time and it should run completely before moving on to the serial communication loop.
    2. I assume that you have configured the port series and characters of endpoint set, etc. in a main vi
    3. Please try the VI updated seal and let us know if this helps

    Thank you

    Charles Chickering

Maybe you are looking for