Tracking the Date time changes in DatePicker control using Javascript/JQuery

I have two date picker controls(Start Date nd End Date) in my SharePoint Calendar list. And I need to calculate the Hour difference on the fly and show it in a text box.
Can anybody help me to achieve this task using client side scripting?
Thank You in Advance.
Juli

Hi sravankumar1107,
According to your description, my understanding is that you want to figure the difference between start date and end date and then you want to place the value in a text box.
Here is a code snippet for your referecnce:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
</script>
<script type="text/javascript">
function initControl()
var txtstartDate = $("#" + $("label:contains('Start Time Date')").attr("for")).val();
var txtstartHour = $("#" + $("label:contains('Start Time Hours')").attr("for")).val();
var txtstartMinute = $("#" + $("label:contains('Start Time Minutes')").attr("for")).val();
var txtendDate = $("#" + $("label:contains('End Time Date')").attr("for")).val();
var txtendHour = $("#" + $("label:contains('End Time Hours')").attr("for")).val();
var txtendMinutes = $("#" + $("label:contains('End Time Minutes')").attr("for")).val();
var starttime = new Date(txtstartDate +" "txtstartHour +":"txtstartMinute);
var endtime = new Date(txtendDate +" "txtendHour +":"txtendMinutes);
var diff = endtime - starttime;
var diffSeconds = diff/1000;
var HH = Math.floor(diffSeconds/3600);
txtHour.val(HH);
</script>
More information for your reference:
http://stackoverflow.com/questions/21844281/i-am-using-datetime-picker-and-want-that-my-start-and-end-date-must-have-differe
http://blog.pentalogic.net/2009/09/setting-default-duration-for-new-calender-events/
Best Regards
Zhengyu Guo
TechNet Community Support

Similar Messages

  • Fetching Manager Attribute For The User In PeoplePicker Control Using JavaScript/JQuery

    Hi Everyone,
    I need to fetch the Manager, Department and Title information for user listed in PeoplePicker control on SharePoint site and List them in textbox using JavaScript.
    Please suggest the JavaScript code.
    Regards~
    Deepak Arora
    If you Find the Answer | Article | Blog Helpful Please Vote As Helpful / Mark As Answer

    Hi,
    According to your post, my understanding is that you want to get the user’s manager, department and title.
    We can use the GetUserProfileByName operation of the SPServices to achieve it, you can download it in the
    CodePlex.
    You can first retrieve the user of the People Picker control.
    http://sympmarc.com/2012/04/22/working-with-sharepoint-people-pickers-with-jquery-a-new-function-called-findpeoplepicker/
    http://sharepoint.stackexchange.com/questions/80839/unable-to-get-user-name-from-the-people-picker-control-using-jquery
    Then we can retrieve the user’s information using the SPServices.
    I have made a simple code demo to retrieve the user’s manager, department and title as below, you can have a look at it.
    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="http://sp/Shared Documents/jquery.SPServices-2014.01.min.js"></script>
    <script type="text/javascript">
    // When the body is loaded, the onload event handler executes each function whose name is contained in this array.
    $(function(){
    var managerName;
    var title;
    var department;
    $().SPServices({
    operation: "GetUserProfileByName",
    async: false,
    AccountName: $().SPServices.SPGetCurrentUser(),
    completefunc: function (xData, Status) {
    console.log($(xData.responseXML).find("PropertyData").parent().html);
    $(xData.responseXML).find("PropertyData > Name:contains('Manager')").each(function() {
    managerName = $(this).parent().find("Values").text();
    //alert("the manager is"+managerName);
    $(xData.responseXML).find("PropertyData > Name:contains('Title'):eq(0)").each(function() {
    title = $(this).parent().find("Values").text();
    //alert("the Title is"+title);
    $(xData.responseXML).find("PropertyData > Name:contains('Department')").each(function() {
    department = $(this).parent().find("Values").text();
    //alert("the Department is"+department);
    var obj1=managerName+title+department;
    $("#Test").text(obj1);
    </script>
    <span id="Test"></span>
    More reference:
    http://sympmarc.com/2012/04/22/working-with-sharepoint-people-pickers-with-jquery-a-new-function-called-findpeoplepicker/
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • How do I change the Date/Time on a Time Capsule?

    Problem:
         I have set up Timed Access Controls on my Time Capsule to restrict the hours my children can access the internet.  Because this allows limitations on each device it is convenient to restrict their phones but not interfere with the desktops (for example).  But the Date/Time on my Time Capsule seems to be incorrect because the Time Capsule is restricting the hours - just not the ones I set (seems to be getting later and later before the change take affect).
    I can't find where to check the date/time or make the modifications to it to confirm.
    I'm using Airport Utility 6.1 (610.31).
    Hope you can help.

    Maybe this helps to install it on Mountain Lion:
    https://discussions.apple.com/thread/4172563
    Cheers
    Georg

  • I have Elements 11. Sometimes, if I edit a photo in Elements Editor, the date gets changed to the current date. Why does that happen? It doesn't happen all the time, so I can't isolate the cause. Any ideas?

    I have Elements 11. Sometimes, if I edit a photo in Elements Editor, the date gets changed to the current date. Why does that happen? It doesn't happen all the time, so I can't isolate the cause. Any ideas?

    I have Elements 11. Sometimes, if I edit a photo in Elements Editor, the date gets changed to the current date. Why does that happen? It doesn't happen all the time, so I can't isolate the cause. Any ideas?

  • How to change the date/time

    Now I chang the CMLocal date/time group and apply it to Device pool for phone, but I find the date/time displayed on phone is wrong ?why?

    I have the same problem with CCM 4.1(3)SR3 and Cisco IP Phone 7970.
    Can you help me please?

  • I just did something on my mac and now the date, time and battery percentage are in arabic and it says lebanon (arabic) in the language and text preference, how can i change it back to english? ps: i'm hopeless.

    i just did something on my mac and now the date, time and battery percentage are in arabic and it says lebanon (arabic) in the language and text preference, how can i change it back to english?
    ps: i'm hopeless.

    So what you want is for it to say Lebanon (English)?  If so, see if this helps:
    http://m10lmac.blogspot.com/2012/05/fixing-custom-english-region-settings.html

  • Can't change the month in the Date & Time preference pane

    I can't change the month in the Date & Time preferences pane. I deselected "Set Date and Time Automatically" but that didn's solve the problem. I would like to trash the preference (plist) for Date and Time but I can't seem to find it. What is it called?

    In the International Formats, the date format is as I have it set, (YYYY.MM.DD) But the MM is neither blue, nor accessible for change. The year can be changed (YYYY or YY), along with several options for the day, but I can't change the month to a different format unless I change the calendar from Gregorian, or if I change from the short date to med, long or full. Although, even then, iCal and Date and Time only show the month as 1, regardless of what it should be, and without any capacity for changing it.
    Thanks

  • How do I change the date/time of a dll created in LabVIEW without killing it

    I use the LabVIEW (6.0.2 of course) Application builder to create a dll, and I cannot enter creation information, nor can I modify the date time property, which labVIEW does not properly set. I have tried to modify this information in Visual C++, but that destroys the dll because it wasn't compiled in VC++, and therefore isn't compatible.
    If anyone knows how to correctly modify the date/time (and the checksum) without destroying the dll, I would be gratefull to know.
    Thank you

    Dear Sir,
    I was browsing through MSDN in trying to find the info you are looking for and I step into this next file:
    "Peering Inside the PE: A Tour of the Win32 Portable Executable File Format"
    Which you can locate in the msdn.microsoft.com page by going to the search box and typing that title. The first result is that document. Also you may want to check the "imagehlp" file of the msdn library. This documents provides information on the DLL standard and functions.
    Good luck!...
    Nestor Sanchez
    Applications Engineer
    National Instruments
    Nestor
    National Instruments

  • How do you vary the Date/Time stamp format in File Adapters

    In the receiver channel of the File Adapter where you specify the 'File Name Scheme', you do have the option of specifying a 'File Construction Mode' of 'Add Time Stamp'.  How can you specify a different Date/Time stamp format ( eg MM/DD/YY vs YYYYMMDD vs MMDDYY, etc. ) without changing the Date/Time stamp for the entire SAP system?  Also, can you control where the Date/Time stamp appears in the filename?

    Hi,
    There are many threads discussing the same issue. Go thro the following:
    Dynamic file name (Date) in Receiver File Adapter
    Receiver File Adapter - TimeStamp
    Bhavesh's reply in above thread:
    You can use Adapter Specific Identifiers and then change the file name in the mapping. Append the tiem stamp in the format that you want and so on.
    Just use this code in an UDF,
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String SourceFileName = conf.get(key);
    java.text.SimpleDateFormat dateformat = new java.text.SimpleDateFormat( "yyyyMMdd" );
    dateformat.format( new java.util.Date() );
    String newfilename=SourceFileName+dateformat;
    // change to new file name
    conf.put(key, newfilename);
    return "";
    Regards,
    P.Venkat

  • How to display the Date Time using the System Time zone

    Friends,
    Can anyone help me with below scenario..
    I have to display Date Time on a jsff page, This value associated to one of Transient View object populated from the database.. Is there any way I can handle on the screen to display the same date /time bassed on the system time zone ?
    I know one way how we can handle it.. while populating to View object we can set the time based on the system time zone.. but it would be easy and simple if there is any approach I can use on UI layer itself..
    thanks

    I don't understand why this display doesn't pay attention to the date/time format settings that are set in the language and text prefs.
    Those settings are used for date OR time, and provide for different displays depending on the space available. The menu bar does not have a fixed space available, and wants both date and time.
    In Leopard, it used the medium time format. To get the date and time, you could modify that format to include the date, but that could cause problems with software that happened to use the medium time format and expectede just the time. Also, you might want to change the medium time format without changing the menu bar display. For these reasons, Snow Leopard's menu bar clock uses its own formatting for data and time display.

  • IPhoto Batch Date/Time change Suggestion

    I recently traveled overseas with my family to a time zone that was +4:30 from my current location. During our trip I took 800+ photographs from my digital camera, 60+ from my iPhone and lots of video from my camcorder. It didn't occur to me until I got back home that not only did I not set the digital and camcorder to the local time where I was vacationing but also my digital camera had somehow been set 2-days back but with the correct home time. So it was actually 2days 4hours and 30minutes behind the time that it should have been. My iPhone photographs were fine because I set it to the local time as soon as I landed there.
    Once I synced my camera & phone photographs I realized my problem as my entire vacation was in a jumbled mess. So then I went through the photographs and split the digital camera and iPhone photographs into 2 albums which was not too hard. Thereafter, I went through the digital camera photographs and adjusted the date/time stamp. Some of them I could do in batches, which is not very easy as you need to look at the current date/time stamp, then select the photographs you want to change and then do the math before making the change. The most of it I had to do individually to make sure they wouldn't get jumbled with the iPhone photographs I had taken. So to say the least, to adjust 800+ photographs took a long time and a lot of effort.
    My suggestion is a simple batch change like what is available already, but with the option to advance or regress the date/time stamp letting the system use the current date/time stamp.

    That command is the adjust time/date command - not the batch change command
    Adjust T/D takes a group of selected photos and applies a constant delta to them thereby correcting for camera setting errors or time zone issues
    Also note that this is a user to user support forum not a path to Apple - it is a great plce for questions about how iPhoto works - it is an extremely poor place to make requests for changes since there is no one here who can do that.
    LN

  • Can I edit the data already displayed in tree control?

    I'm using a tree control to display some data in front panel. But after running the program, can I edit the data already displayed in tree control by using input control and let it change and display dynamically? In invoke nodes I can only find add or delete items in tree but can't find edit...

    There is no direct editing option available, same can be achieved in two steps by using
    --> Add Item Invoke Node
    --> Delete Item Invoke Node
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

  • Is there a solution to the data/time camera metadata problem?

    After a lot of testing I've nailed down a serious flaw with Lightroom, and I'm wondering if people have any sort of solution, either from within Lightroom or externally.
    When Lightroom is used to export JPEGs, the exported files have the correct Image EXIF data stamped in the Date/Time Original and Date/Time Digitized fields - it matches the date/time of the RAW file, which is exactly what you'd want and expect.
    What it doesn't set correctly though is the JPEG file Created, and file Modified dates - they are set as the date/time the JPEG export was done from Lightroom. There are many applications that sort based on the last modified date of the JPEG, and it's illogical that Lightroom wouldn't have the JPEG file metadata match up with the EXIF data. I can't think of a single scenario where you'd want to have two different time/data stamps in the image that you just exported.
    Using ACDSee I can batch change the JPEG file Created and file Modified dates to match the EXIF data. It's an added step I shouldn't have to do, but I can do it. What I *can't* change in batch mode with ACDSee is the Camera Date/Time time - which, you guessed it, is stamped with the time that the JPEG was *created* during the export, not the time that the camera was set for when the RAW file was captured, which is what it SHOULD be set to. It should be stamped with the EXIF date/time original data. I think I already know the answer to this, but is there any setting in Lightroom that addresses this issue?
    I've seen others recommend EXIFtool but using a command line tool isn't what I consider a reasonable suggestion. Are there any other tools that might help me here?

    Jason -
    <br />
    <br />You mentioned that the CreateDate wasn't set correctly in your files. For my JPGs exported from LR, based on Canon CRW raws, the CreateDate does match the DateTimeOriginal. ExifTool is reasonable enough for me; here is a sample output of ALL the date/time related fields in one of my exported JPGs.
    <br />
    <br />
    <span style='font-size:10.0pt;font-family:Courier'>[File] File Modification Date/Time : 2007:07:28 11:25:31
    <br />
    <br /> [EXIF] Create Date :
    <span style='mso-spacerun:yes'>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#16 0;&#160;&#160;&#160;&#160;&#160;</span>2007:07:21 15:29:14
    <br />
    <br /> [XMP]
    <span style='mso-spacerun:yes'>&#160;</span>Date/Time Original :
    <span br="" /></span>style='mso-spacerun:yes'&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#16 0;</span>2007:07:21 15:29:14-05:00
    <br />
    <br />[XMP]
    <span style='mso-spacerun:yes'>&#160;</span>Date/Time Digitized :
    <span br="" /></span>style='mso-spacerun:yes'&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;2007 :07:21 15:29:14-05:00
    <br />
    <br />[XMP]
    <span style='mso-spacerun:yes'>&#160;</span>Modify Date :
    <span br="" /></span>style='mso-spacerun:yes'&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#16 0;&#160;&#160;&#160;&#160;&#160;&#160;&#160;2007:07:28 11:25:30-05:00
    <br />
    <br />[XMP]
    <span style='mso-spacerun:yes'>&#160;</span>Metadata Date :
    <span br="" /></span>style='mso-spacerun:yes'&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#16 0;&#160;&#160;&#160;&#160;&#160;2007:07:27 14:35:04.062-05:00
    <br />
    <br />
    <br />
    <br />As discussed by other posters, I agree that the ModifyDate needs to reflect the most recent activity on this particular file, and is not related to the original capture time.
    <br />
    <br />Gary

  • Is the date/time in Milliseconds dependent on the underlying timezone

    Hi,
    A Timestamp is received as an argument to a method. It is meant to be for the Time Zone "America/Los_Angeles".
    The value of the Timestamp is "2001-06-06 10:10:10.1".
    The JVM Time Zone is "America/New_York".
    The output of <Timestamp>.getTime() is
    991836610000
    Then I change the default Time Zone to "America/Los_Angeles" and create a new Timestamp with a value of
    "2001-06-06 10:10:10.1". The same as the above Timestamp.
    The output of <Timestamp>.getTime() is
    991847410000
    If I create a new Timestamp object using the value of 991836610000 milliseconds when the default Time Zone is "America/Los_Angeles", the date/time that is given is
    "2001-06-06 07:10:10.1
    The API for <Date>.getTime() states that "Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.". It doesn't mention that it is dependent on the Time Zone in which the Date object was created. Hence I was assuming that the same value will be returned irrespective of the Time Zone the Date object was created in. However it appears not to be so.
    Is there a way to work with date/time objects without been influenced by the underlying default Time Zone? i.e without having to change the underlying Time Zone when working with objects created in one Time Zone and with a need to be applied to a different Time Zone?
    Thanks
    Harsha

    As malcolm pointed out, the problem is that when you parse the date, a reference timezone must be used. If you don't explicitly specify a reference timezone, the default timezone will be used.
    Is there a way to work with date/time objects without
    been influenced by the underlying default Time Zone?
    i.e without having to change the underlying Time Zone
    when working with objects created in one Time Zone and
    with a need to be applied to a different Time Zone?Make sure you specify which timezone the parsed time is in:
    String localTime = ...;
    TimeZone localTimeZone = ...; // you presumably know this
    DateFormat df = ...; // get a formatter for parsing your date
    df.setTimeZone(localTimeZone);
    Date date = df.parse(localTime);

  • It seems that the last message sent in imessage doesn't show the date/time.

    When I look at the imessage screen it doesn't show the date/time on last messages.

    Claudia252 wrote:
    Thank you. I cant figure out how to change the lable infront of the number to "iPhone" . It shows "home", "work", "pager", etc. but it doesn't show an "iPhone" option.
    In the Contact, tap Edit.
    Tap the label in front of the number and another Label screen apears.
    Tap the label you want to use.

Maybe you are looking for