Add one hour to a date variable

Hi,
suppose there is a variable current with 'DD-MM-YYYY HH:min:SS'
how i can add one hour and find a new variable one_hour_later
?

sql>
select sysdate,sysdate+(1/24) added
from dual;
SYSDATE ADDED 
02-02-2007 12:58:42            02-02-2007 01:58:42
jeneesh                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • How can i add one month to a date variable ?

    Unlike the week which always 7 days, month may change from 28 to
    31, so how can i add one month to a date variable ? Thanks in
    advance.

    Adding 365 won't always work because of leap years.
    You could use the following SQL statement:
    SELECT
         TO_DATE(
              TO_CHAR(TO_DATE(SYSDATE), 'DD-MON-') ||
                (TO_CHAR(TO_DATE(SYSDATE), 'YYYY') + 1)) NEXT_YEAR
    FROM
         dual
    NEXT_YEAR
    08-JAN-03Or you could create your own function. You would use this
    exactly like add_months:
    CREATE OR REPLACE FUNCTION add_years
         (v_date DATE, num_years NUMBER)
    RETURN DATE AS
         v_year DATE;
    BEGIN
         v_year := TO_DATE(
                   TO_CHAR(TO_DATE(SYSDATE), 'DD-MON-') ||
                         (TO_CHAR(TO_DATE(SYSDATE), 'YYYY')
                                             + num_years));
         RETURN v_year;
    END;     
    SELECT
         add_years(SYSDATE, 1) new_year
    FROM
         dual
    NEW_YEAR 
    08-JAN-03
    SELECT
         add_years(SYSDATE, -1) new_year
    FROM
         dual
    NEW_YEAR 
    08-JAN-01

  • How to add one second to a date time stamp

    What is the proper syntax to add one second to a date/timestamp?

    Just think about it.
    24 hours in a day, 60 mins per hour and 60 second per minute
    total of 86400 seconds per day.
    So, you add 1/86400 to the date/timestamp column
    e.g. select my_date + (1/86400) from my_table;
    What is the proper syntax to add one second to a date/timestamp?

  • How to add one day to a Date?

    Hi,
    What is the simplest way to daa one day to a Date object?
    Thanks.
    Pengyou

    You use a database query just to add one day
    to a Date object? I wouldn't call that the "simplest"
    way at all.I was going to suggest firing off an email to the naval observatory and having them carry out the calculation, emailing the result back (maybe using JMS, not sure - web service possibly?) but the OP's way is simpler.

  • Add one day to current date

    Hi ,
    can anyone tell me the logic for add one day to sysdate()?
    Thanks and Regards,
    Ranjith.

    Hi Ranjith K,
    you can use sysdate()+1 to increment the system date.
    I hope this will help you out.
    Regards,
    Akhileshkiran.

  • Current Date one hour before system date

    Hi,
    When I use java.util.Date currentDate = new Date(); the result turns out to be 1 hour earlier before my system date. Does anybody know how this is possible?
    Greetings,
    Marcel

    koekie17 wrote:
    - Control Panel -> Regional and Language Options -> [tab] Regional options -> Language and Location dropdownboxex changed to my country
    - Double click on time in Windows taskbar -> [tab] Timezone -> Selected GMT + 1
    I kind of doubt that the first has anything to do with it. Nothing I saw said anything about daylight savings time (DST.) I know the second doesn't fix it. The second sets the timezone without daylight savings time (DST).
    Only way I know for sure There might be some way via the control panel.
    taskbar ->"Adjust Date/Time"->Timezone tab->check box (at bottom) "Automatically...for daylight saving changes"

  • Add i hour to date

    My date field have the following data:
    20040805093538
    I need to add one hour to the date once I get it from my cursor.
    How do I do this?

    Is your field datatype a date or varchar ?
    If date, follow Jens' suggestion, if not you need to firstly transform this char to date then add an hour :
    SCOTT@demo102> select to_date('20040805093538','YYYYMMDDHH24MISS')+1/24
      2  from dual;
    TO_DATE('2004080509
    05/08/2004 10:35:38
    SCOTT@demo102> And to return to your original format :
    SCOTT@demo102> ed
    Wrote file afiedt.buf
      1  select to_char(to_date('20040805093538','YYYYMMDDHH24MISS')+1/24,'YYYYMMDDHH24MISS')
      2* from dual
    SCOTT@demo102> /
    TO_CHAR(TO_DAT
    20040805103538Nicolas.
    Sorry Indy, I didn't refresh the web page... and didn't see your post.
    Message was edited by:
    N. Gasparotto

  • Editing dates - iPhoto adds an hour!

    Hi,
    I've been editing the dates of my photos and I'm finding that iPhoto increases the hour by 1 hour. For example, I enter 10:12:35 AM and it will make it 11:12:35 AM.
    Anyone understand what it is doing?
    Also, if an developers are reading this...how about allowing users to edits EITHER the date or the time. Sometimes, I only want to make a change to one, without the other changing. (For example, it would be nice to change the hours on photos that I take in another time zone from where my camera thinks it is. Just a suggestion...
    Thanks,
    Jeff

    My iPhoto '08 under Leopard started doing the same thing immediately after the time change on Nov. 4th. I type or paste in a certain time & it adds one hour to the time.
    I hope there is an update to this bug soon as I am in the middle of manually changing the time on a couple of hundred of photos that were sent to me where the time was not set correctly (processed off of film & have date/time of when batch digitized).
    -Keith

  • Add one day to the current date

    Hi all,
    A stupid question...
    How can I add one day to the current date in a select. I want something similar to add one month to current date, but with days:
    something like:
    select TO_CHAR (ADD_MONTHS (SYSDATE, -1), 'DD-MM-YYYY')
    from dual
    Thanks

    select sysdate+1 "add one day" from dual;

  • Add one day to java.sql.date

    I ask user to enter a date: yyyy-mm-dd, then I want to add one day to that date, I don't know how to do it?
    java.sql.Date time2 = java.sql.Date.valueOf( args[0] );
    Many Thanks.

    since a date object is really nothing more than a long you can always add one day's worth of milliseconds to it....
    long milliInADay = 1000 * 60 * 60 * 24;
    Date d = ......
    d.setTime(d.getTime() + milliInADay);although there may be some issues with this i'm unaware of, but seems pretty straightforward to me.

  • Oracle date function to add one second

    how to add one second to the date, example, SYSDATE+1 will add one day to current day, but how to add one second to the current time. for example, the current date is "2006-4-21 12:01:12", and I want to add 1 second to the current time, and the result will be "2006-4-21 12:01:13", how to achieve it??

    select to_char(sysdate,'hh24:mi:ss'),
    to_char(sysdate+1/24/60/60,'hh24:mi:ss') from dual;
    TO_CHAR( TO_CHAR(
    09:44:44 09:44:45

  • Adding 3 weeks to a Date variable

    Hi,
    In order to levy a fine,it must be calculated,
    it therefore makes sense for the system to check for overdue books.
    in order to use
    if Date.after(dob)=true{
    FINE$
    I must add 3 weeks to the date variable "dob" (date_of_borrow,stored on a database in dd-mm-yy format)
    How do i do it?
    The only other alternatives i have are Calander or milisec-day conversions.I'm unsure on using GregorianCalander & people have advised against milisec.
    (you can see why, in the forum post "Urgent:Html & Servlet").
    Anyway i hope this will work.
    Suggestions anyone?Thanks.
    Aesh83

    is it as easy as saying .getWeek()?Must i set the system date on it or is it anyway default?-
    Here is a something i cooked up ,in a hurry, (HELP!!: How do u use sdk with Kawa editor) ,i'm working in the dark hoping i can find the light..
    Ah here it is-
    int dob2;
    //it suposed to trigger whenever user opens borrow.htm//
    date.format(dd-mm-yy);
    dob.format(dd-mm-yy);
    rs=stmt.excecuteQuery("Select dob from LENT where UserN==User_N");
    LOOP
    getdata into a resultVector
    dob.elementAt(i);
    if Date.after(dob)=true{
    FINE$
    LOOP
    What do u think?Needs improvemnts.
    How do you get System date onto a Date variable?
    Will date.after(Date when) method work when Date variables are in milisecs?
    Thanks & Bye!
    aesh83

  • What is the best way to add a day to a Date object?

    I have come across numerous examples on adding a day to the CURRENT date, using the Calendar object. However, what I need to do is to add a day to a Date variable.
    Can someone tell me how to do that? I tried to set the value of my Date variable into the Calendar object, but, it appears that for the current JAVA version, they have deprecated the getYear(), getMonth() and getDay() methods for the Date class.
    Really appreciate your suggestions.
    Thank you in advance,
    SiowLing

    I haven't seen the OP express a concern over how to create/obtain the Date object (he could be using "new Date()" given the emphasis on "CURRENT"). Milliseconds is fine too if that's what you have (for example from a java.sql.Date).
    So the way to add a day to a Date object (the OPs original question) is to:
    - set the Date on a Calendar using setTime
    - add 1 to the DATE field of the calendar
    - get the Date from the Calendar using getTime
    Obviously you're right if the OP doesn't have Date object to start with, but just the "numbers" for year, month, day.

  • Add one day to a binding

    Hi all,
    I assume this is a very dumb question... How can I add one day to a date that is like this :
    #{bindings.ChooseDateCrah.inputValue}
    It's a binding in a the header text property of a column.
    That : #{bindings.ChooseDateCrah.inputValue + 1} or that : #{bindings.ChooseDateCrah.inputValue} +1 does not work.
    Thanks.
    Frédéric.

    Hi Frédéric,
    Yeah, you cannot apply a converter on the headerText attribute of a column. However, you can instead place an outputText in the header facet of the column, then the converter option still works.
    As for the code, no, in the RowImpl object in the getter method of your calculated attribute. (That method is quite complicated for a read only value though).
    You can check my reply at Re: How to access menbers of the current row of an af:table component? as for how to create a custom converter. In your specific case, however, you would have to extends DateTimeConverter and decorate the getAsObject and getAsString methods in order to add one day before calling super.getAsString and remove one day from the returned value of super.getAsObject before returning to ensure reversibility.
    A managed bean solution would imply the use of the implements Map EL hack which is both easy and hard, depending on your experience level with JSF and EL.
    Regards,
    ~ Simon

  • QA: Designer's operation to Add one more Field to display in Query Result Web Part

    QUESTION ABOUT Query Result Web Part presentation +1 Field
    I'd be looking at a property of Web Part to look up Discussion Board through Query Result Web Part. Currently it displays 'Title' column of Discussion Board, and my caring requirement is presentation customization to hold double
    columns of 'Title'+'Updated Date'. How could I add one more field 'Updated Date' to display in addition to that preexisting 'Title' field?
    Any procedural steps to realize how to add Filed to display in Query Result Web Part?

    Hi Yoshihiro,
    As I understand, you want to add the field to display in Query Result Web Part in SharePoint 2013.
    Which web part does you use? Content query web part or search results web part?
    If you use search results web part, you could edit the discussion board result template and add the updated field in the template.
    You could go to Design Manager: Edit Display Templates (site setting-> look and feel->design manager->edit display template), download the Discussion Item.htm file, and edit the file. 
    After editing, upload the file.
    The articles below are about how to modify an existing Display Template in SharePoint 2013.
    http://www.learningsharepoint.com/2012/09/17/sharepoint-2013-the-new-display-templates-for-styling-your-content/
    http://blogs.technet.com/b/sharepoint_quick_reads/archive/2013/08/01/sharepoint-2013-customize-display-template-for-content-by-search-web-part-cswp-part-1.aspx
     If you use content query web part, you could edit the content query web part, in the Property Mappings section select the “Change the mapping of managed”, and add the “modifiedOWSDATE” (it means the last modified date) in the line, after
    that you could see the update date under the title.
    Best regards,
    Sara Fan
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

Maybe you are looking for

  • How do I get my email to work.

    My email worked great with Mavericks and before.  Now I am unable to send and or receive emails on my Mac/Yosemite.  the same account still works fine on my MacBook/ (not upgraded to Mavericks) and my iphones and ipads.  I have spent hours with the I

  • Substr function problem in oracle

    my requirement is that i am writing the stored procedure in which use *substr( source_string, start_position, [ length ] )* my 1 requirement i have i problem that the source_string is dynamically being passed as a parameter into the stored procedure

  • Roland GI 20 USB Driver Problem

    I have an iMacG5 and have a Roland GI 20 USB interface for my 13pin guitar.I get this message after succesfully installing the driver: Right when I turn on the unit. "/System/Library/Extension/RDUSB0040Dev.kext" was installed improperly and cannot be

  • Rebuilding corrupted library after upgrade to iPhoto 6.0.5

    I upgraded today to iPhoto 6.0.5 and experienced the problem that many people here have discussed -- missing photos, greyed out thumbnails and images, and so on. Just a small number of recent photos show up, out of about 15000. All the photos seem to

  • HT4101 lightning sd camera reader

    Ipad Air,ive recently bought the lightning to SD Card Camera reader. put in my sd card and then the lightning reader into the ipad air, and it fails to reconise the reader saying there are no photos to upload, any ideas