How to present datetime objects as separate date and time objects?

Hello,
I store the working times of employees as records containing two datetime fields:
- begin: datetime
- end: datetime
I would like to keep this design, because a working time may cover several days, e. g. beginning at 2015-04-14 22:00 until 2015-04-15 07:00.
However, in a simplified user interface, I would like to let the user edit his working times using a date field and two time fields:
- date: date
- begin: time
- end: time
As a first approach, I created a form in a datasheet view, with the following fields:
- txt_date: the date (unbound)
- txt_begin: the begin time (unbound)
- txt_end: the end time (unbound)
- begin: the real database field 'begin' (datetime, bound, hidden)
- end: the real database field 'end' (datetime, bound, hidden)
When the user edits the fields txt_date, txt_begin and txt_end, I catch the AfterUpdate event and then update the database fields begin and end.
This seemed to work at the first sight. However, then I noticed that changes to the database bound fields affect all rows of the datasheet view. So this is not a suitable solution yet.
Is there any trick to get this to work? I also have other use cases where I want to modify fields in a datasheet view...
Thanks
Magnus

You need to assign values to the bound controls in each of the unbound controls' AfterUpdate event procedures, as follows:
Private Sub txt_Date_AfterUpdate()
    Me.Begin = CDate(Nz(Me.txt_Date)) + CDate(Nz(Me.txt_Begin))
    Me.End = CDate(Nz(Me.txt_Date)) + CDate(Nz(Me.txt_End))
End Sub
Private Sub txt_Begin_AfterUpdate()
    Me.Begin = CDate(Nz(Me.txt_Date)) + CDate(Nz(Me.txt_Begin))
End Sub
Private Sub txt_End_AfterUpdate()
    Me.End = CDate(Nz(Me.txt_Date)) + CDate(Nz(Me.txt_End))
End Sub
This assumes that no shift spans midnight of course.  For an example of how to handle shifts spanning midnight take a look at Timesheet.zip in my public databases folder at:
https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169
If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.
This little demo file includes functions which handle values entered as times where a shift might span midnight, assuming that a shift will always be less than 24 hours duration.  
Ken Sheridan, Stafford, England

Similar Messages

  • Separate Date and Time report parameters in SSRS 2012

    Hi Forumers'
    I m trying to design a report in SSRS with Separate date and time parameters
    I would like to have four parameter StartDate,EndDate,StartTime and EndTime.
    reports should be filter on all four parameter.
    can any one help me on this. i am using stored procedure to fetch data from db.
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE[dbo].[GetIVRTime]
    @StartDate varchar(50),
    @EndDate varchar(50),
    @StartTime Varchar(50),
    @EndTime Varchar (50)
    AS
    BEGIN
    DECLARE @Names VARCHAR(8000)
    BEGIN
    Select Convert(varchar(12),timestamp,105)As Date,CONVERT (VARCHAR(12), timestamp, 108) As Time,
    Count(cli)As TotalCall,
    SUM(case when ivrsuccess=1 then 1 else 0 end)as IVRSuccessfull,
    SUM(case when ivrsuccess=2 then 1 else 0 end)as IVRunsuccessfull,
    SUM(case when exitreason=1 then 1 else 0 end)as PBOTransferred,
    SUM(case language when'ENG'then 1 else 0 end)as EnglishCall,
    SUM(case language when'HIN'then 1 else 0 end)as HindiCall
    From tbl_ivrmaster
    where callstartdatetime>=@StartDate and callenddatetime<=dateadd(dd,1,@EndDate)
     and callstartdatetime>=@StartTime and callenddatetime<=@EndTime
    group by Convert(varchar(12),timestamp,105),CONVERT (VARCHAR(12), timestamp, 108)
    END
    END

    Hi Nirmal,
    I have tested on my local environment that as Visakh16 mentioned that you can use function like DATEADD(dd,DATEDIFF(dd,0,@StartDate),@StartTime) 
    to get the date/time value based on the date and time parameter you have selectted.
    There is also anoher method to add filter in the dataset but not in the query.Details information below for your reference;
    Please change the datatype of the @sartdate and @enddate from text to date, if you don't specify an availbel value for these two parameters, you will get an calender picker to select the date.
    I assumed the two time parameters will enter the value which format like:hh:mm or hh:mm:ssYou can conver the datetime field in the table to string and then compare with the conbine of the date and time field to filter the data
    like below:
    Filter add in the dataset like:
    Expression:=FormatDateTime(Fields!DateTime.Value)           (String type)
    Operator: Between
    Value:
    =Parameters!StartDate.Value &" "&Right(TimeValue(Parameters!StartTime.Value),8)
    =Parameters!EndDate.Value &" "&Right(TimeValue(Parameters!EndTime.Value),8)
    Preview the report:
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • How can I get rid of the dates and time on my Notes

    How do I get rid of the dates and times on my Notes that appeared when I updated to 8?

    Yes, it's seems like a poor design decision.
    By putting the date on the line below the Note title in the Notes Index, the app shows half the number of notes per page AND if you have a large number of notes, it takes twice as long to stroll down.
    I doubt the designer actually uses the app. 
    TSAW

  • How to Separate Date and Time

    Hi All,
    Iam New to Power Pivot,I have Date and Time in the Same Field (2014-09-04 19:20:37.637) and now i want Separate Date in one field and time in one Field.can any one Help on this.
    Ex:  (2014-09-04 19:20:37.637)
    Date                               Time
    2014-09-04             19:20:37.637
    Thanks & Regards,
    Sivakumar

    Siva, is this still a problem?
    Thanks!
    Ed Price, Azure & Power BI Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • How do I delete duplicate songs? (date and time stamp are identical

    I put my cd collection in itunes and now have duplicates of most songs (don't know how I did that). The duplicates have the exact same date and time, so the method to delete a "newer" duplicate will not work. Is there a simple way to delete exact duplicates from the itune library?

    This application can help.  It's US$15.  http://dougscripts.com/apps/dupinapp.php

  • How to rename a flat file concatenating date and time the file name?

    I created a package where I run a first interface that uses a flat file from a server and load into a table in Teradata.
    After using the API OdiFtpPut, I used an FTP file and send to an outfit.
    Since this procedure will operate daily, I need at the time of FTP, get the concatenation destination file name, date and time of execution.
    What is the best practice for this?

    Using OdiFtpPut in the field where it informs the destination file name, instead of putting just the file name (lpn_pln.csv), I put as follows:
    - lp_pln_+<% = odiRef.getSysDate (ddMMyyyyhhmm ")%>+. csv
    For code example, today would record the name lp_pln310120111412.csv
    Anything you can add my msn ---> aluizs @ ig. com. br (no spaces)
    Edited by: andre_l_soares on 31/01/2011 08:16

  • How to find the shipping point creation Date and time

    Hi All,
      Could you please help to solve this issue.
       Some of the users created shipping point, Now I have to find out in which date and time the shipping points were created, is there any table to find. please help me.
    Regards,
    Muralikrishna

    hi Murali,
    first define and assign shipping point in enterprise sructure in define shipping point EC07 and assign in OVXC
    goto OVL2 and assign the shipping points
    The following are used for the shipping point determination:
    1. Shipping conditions - Proposed from CMR. The entry in VOV8 for the sales document type if there overwrites the entry in the shipping conditions mainatined in the CMR.
    2. Loading group - Proposed from the material master record.
    3. Plant - proposed from CMIR - if not found then CMR - if not found then MMR.
    But you should first define and assign the shipping point in the "enterprise structure" otherwise you will not be able to do the shipping point determination.
    IMG - logistics execution - shipping - basic shipping functions - shipping point & goods receiving point determination - assign shipping points.
    Shipping point definition:
    IMG - enterprise structure - definition - logistics execution - define, copy, delete, check shipping point. You have to define the shipping point here for the particular plant.
    Shipping point assignment:
    IMG - enterprise structure - assignment - logistics execution - assign shipping point to plant. Here select your plant and assign the shipping point to the same.
    hope this helps,
    cheers,
    Hema.

  • How can we update the last synchronization date and time..on SUP in sccm 2012 R2

    Hi,
        Can you any one please guide me how can i update the last  synchronization date & time in SUP on SCCM2012 r2 , some how its updated as future date and when ever i try to synch the SUP with disconnected WSUS its shows in the wsyncmgr.log 
    "Wakeup for a polling cycle " and  " Wakeupby inbox drop" and "Wakeup by SCF change"  
    Thanks 
    Balaji K

    You'll probably have to call CSS on this one as this not normal by any means. The messages you noted above are completely normal but if that's all you are seeing then there's an issue.
    Have you reviewed wcm.log and wsusctrl.log?
    Jason | http://blog.configmgrftw.com | @jasonsandys

  • How to get the  of last   Exicution date and time   of a program

    Hi all ,
    Is there any table which stores the last exicution Time And Date of a report.
    plz give me the table which stores above details.

    Check out STAT and STAD transactions or
    try table D010SINF

  • How do i print off deleted messages dates and times sent and received

    @@

        Hi Nickass3,
    Great question! I know that printing your messages is important. You sign into your MyVerizon http://bit.ly/xB4iTc  account and click on Messages>Usage details>Click the print icon located at top of the screen.
    Thanks,
    PamelaF_VZW
    Tweet us @vzwsupport

  • How to get the date and Time?

    Hi,
    I am using Jdev 11.1.2.0.
    I had one database table. In that table one variable as bgnDtm and the datatype as oracle.jbo.domain.Timestamp. In my Impl class I declare one variable as beginDate(DateType as oracle.jbo.domain.Date).
    Now I am using the conversion as beginDate=(Date) SampleVO.getAttribute("bgnDtm ");.If I using this scenario I got the Type cast error. so how can I separate Date and Time value.
    So how to do. Please provide some suggestions.
    Regards,
    Ragu.

    you can get the time value either from oracle.jbo.domain.Timestamp or from oracle.jbo.domain.Date
    oracle.jbo.domain.Timestamp timeStampDate = (oracle.jbo.domain.Timestamp) SampleVO.getAttribute("bgnDtm");
    Time time;
            try {
                time = timeStampDate.timeValue();
                System.out.println(time);
            } catch (SQLException e) {
                e.printStackTrace();
            java.sql.Date sqlDate=timeStampDate.dateValue();
                oracle.jbo.domain.Date jboDate=new oracle.jbo.domain.Date(sqlDate);
            Time timeValue = jboDate.timeValue();
            System.out.println(timeValue);Edited by: M.Jabr on Dec 23, 2011 1:55 PM

  • How to judge if one string is  date or  time

    hi everyone,
    how to get to check if one string means date or time? Any sugestion is appreciated.
    Julian

    Hi julian ,
    just give the example for a string how u are storing the formats for date and time in ur system ,
    i mean what is the length of the date field and time field in ur text format
    will it be same ,,if so give us a value (or a set of values )to work on a specific logic
    cause system takes 8 chars for date field and 6 chars for time field ,,
    also ur requirement is asking for a date or time check on a specific string ,
    but i cant put the same string for two fields check ...
    if that is the scenario y dont u put
    field string
    DXXXXXX,
    TXXXXXX,
    DXXXXXX,
    DXXXXXX,
    TXXXXXX,
    this way ..
    differentiate with a tag
    field string+0(1) = 'D', --->DATE FIELD
    ELSE                         TIME FIELD.
    regards,
    vijay
    data date type d value '20061014'.
    DATA TIME TYPE T VALUE '154633'.
    WRITE (8) TIME USING EDIT MASK '__:__:__'.  "Output: 15:46:33
    write (10) date using edit mask '__/__/____'.
    write  time using edit mask '______'.
    *my logic is system uses internally 8 chars for date field and 6 chars
    *for time field

  • I am looking for a timer that shows elapsed time since a particular date and time.  Showing days, hours, minutes etc.

    I would like to download an application for my desktop and maybe even my iphone that will tell me how many days, hours, minutes, etc have elapsed since a particular date.
    For example, my brother just had a baby and I want to put that date and time into the app and then determine how long it has been since that date and time.
    Hopefully this makes sense, because I have not been able to locate anything.
    Thanks in advance,

    This is fantastic.  Thank you.
    Is there any way to have something like this displayed on my desktop showing the time as it ticks away?

  • Naming for Export dmp file in Date and Time

    Dear All,
    Please advise me how to give the file name in date and time stamp for the export dmp file and it's log file.Suggest me in Oracle 9i version.
    for example the file name get like this 020420041155.dmp and 020420041155.log where date and time are 02/04/2004 11:55 respectively...
    Kindly let me know the syntax of filename to be given along with the EXP command..
    Thanking You,
    Ragesh

    Hello
    I don't think you can get the exp command to automatically name an export for you. The only way I think you would be able to do it is through a shell script or something where you format the file name yourself and pass it to exp. If you wanted to you could generate the command line through a SQL statement and then spool it out to a file i.e.
    spool runexp.bat
    select 'exp user/pwd@tns file='||TO_CHAR(SYSDATE,'DDMMYYYYHH24MI')||'.dmp tables=(table1,table2)' from dual;
    spool offThe second option isn't as flexible as the first but if it's just a couple of exports you have to do, it will probably prove to be less work
    HTH
    David

  • Actual Finish date and time

    Hii
    How can we set the actual finish date and time to be logged at the time of Technical completion ?? 
    Thanks and Regards
    BK

    BK,
    The "Work ends on" field should be open for edit in IW41.
    This field entry populates the "Actual finish date" in the operation when the "Final confirmation" flag is switched on in posting the time confirmation.
    Check the settings in the IMG for: Set Field Selection for Completion Confirmation.
    It sounds as though this has been set to "display only". There is no reason to have this control unless the system is set to enable posting in the future. Then folks would be able to cheat on their time.
    The future date posting should only be switched on in development or test clients for test purposes.
    However, from your description of the process, I would have expected the date and time to have defaulted as the current date and time.
    Could there be a user exit at work?
    We seem to have wandered away from the original question you were asking about setting the order "finish" date from technical completion. Were you refering to "Basic Finish Date"?
    The configuration in Define Proposed Reference Time for Technical Completion can be configured to be Current, Created on, Basic start, Basic finish, but this relates to the reference date of the order.
    Or are we on track now with the problem around the operation "actual finish date"?

Maybe you are looking for

  • ITunes original on broken laptop

    Hi I'm using an iPad 2 with the original details for an iTunes account however the original laptop that I set iTunes up on is broken and unfixable. I didn't set it up so it would share with other devices as I'm not an iPhone user therefore I cannot n

  • Migrate or Restore?

    Hi, I currently have a MacBook air running 10.6.2. I just got a new 13" MacBook Pro (unibody) and I'm switching machines. (needed more hard drive space/speed). I have a complete back up on my Time capsule. Am I better off using the restore function f

  • How can I get a sim card for my iphone 5 that I bought on craigslist?

    Where can I find a sprint sim card for my iphone 5

  • Query Sales By Quarter

    Hello, Need to build a query that gives sales data by quarter from 2009 to current year end of quarter. I think I have to use offset variables and build a structure, any hints or pointers in the right direction would be appreciated. thanks

  • Corresponding R/3 table.

    Hi All, I have a R/3 Quantity field thats populating another quantity field in BW. I think its getting the wrong numbers. How can go back to R/3 to check if the numbers match. I have the technical name of the R/3 field but not sure in which table its