Incorrect timestamp control value - labview

After placing Timestamp control on my panel, I've changed it's properties to display only time, as I don't need date part.
Value shown on this control is, as expected, 00:00:00, but if I press up button I get 01:00:01, 01:00:02, ..., or if I press down button, I get 00:59:59, 00:59:58 and so on.
If I write 01:00:00 inside a text box of the control, it automatically switches back to 00:00:00.
If I change timestamp value to double, I get 0 for 00:00:00, -1 for 00:59:59, and 1 for 1:00:01.
So it seems as if this control uses 01:00:00 as a base time. Inside it's properties I've found minimum value of 01:00:00,000 1600-01-01. Changing it to 00:00:00 doesn't give expected result.
Is there any way for this control to work properly as a normal time span control ?

I don't know if the behavior is correct or not, but I can explain it.
The problem is that you're using absolute time. In absolute time, LV uses the first midnight of 1904 UTC as the epoch (the zero value) and when you have that value it displays it as all zeros. Once you change it, the display goes back to normal. The reason you're seeing 1:00:00 as the base is because you're in the GMT+1 timezone and LV automatically fixes the display when the value is not zero.
What I would suggest is replacing the timestamp control with a numeric control, going to the format page in the properties and changing the control to display relative time.
Alternatively, if you do want the time to be absolute, then set the value of the control to the correct timestamp using a local variable before starting.

Related

DateTimePicker Default Value

I am using VB.Net 2008.
I have two DateTimePicker. The first has a default value 8/24/2017 1:35 PM (as it was created Aug. 24. The second one has the default value of what is the current date and time. I haven't set their default values in Properties.
It is just weird for me that they have different default values. Anyway, my desired value is the current date and time.
I have also experienced confusion on my previous project regarding DateTimePicker where it has always default time 1:32 PM where time should be disregarded. The format is "Short" and the default value is the current date w/o time.
Can anyone explain why it happens?
Thank you in advance.
In my experience, a DateTimePicker contains the current date and time in its Value property unless you set it otherwise. Why that should not be happening for one of your controls, I don't know. In that case though, I'd suggest simply deleting that control and adding a new one. Hopefully that will behave as expected.
There's no such thing as a DateTimePicker that "disregards" time. The Value property of a DateTimePicker is type DateTime and a DateTime ALWAYS has both a date component and a time component. You can set the Format and optionally CustomFormat properties to show only the date, only the time or only some part thereof but that makes exactly zero difference to what's stored in the Value property.
Just like for any other DateTime value, if you want the Value of a DateTimePicker to represent just a date then you should zero the time. If you want to use the current date without a time then use DateTime.Today, where DateTime.Now would get you the current time as well as the current date. If you want to zero the time of any DateTime value, including the Value of a DateTimePicker, then you get its Date property. Note that that does not affect the original value, but creates a new DateTime value with the same date and the time zeroed, e.g.
Dim selectedDate = myDateTimePicker.Value.Date
Note that DateTime.Today simply returns DateTime.Now.Date.

Default value in an iterationcombo box

Is there any way i can have the current iteration selected (based on the current month/date and comparing it with the start/end dates of the iteration that fall in that month) when the iteration box is loaded. This is to avoid having the user select the iteration and that "change" event then triggering my custom app.
In short i need to configure the iteration combo box to always default to the current iteration, and treat this default as a change event and have the app execute the on ready/change function.
This should be the default behavior:
https://help.rallydev.com/apps/2.1/doc/#!/api/Rally.ui.combobox.TimeboxComboBox-cfg-defaultToCurrentTimebox
Is it not behaving that way? Maybe you can share a bit more code?

Display Hours on Vertical axis in SSRS

I have a graph in SSRS which displays info from a SP. The SP displays the duration of a process we have that runs daily. looks something like:
Date | Duration
2015/09/23 | 00:21:32
2015/09/22 | 00:28:43
2015/09/21 | 00:25:54
....
I am trying to display this information in a bar graph in SSRS so the dates are displayed on the bottom, and the bar represents the duration.
I have gotten it to display the time, but it is displayed as:
12:21 AM
Instead of:
00:21:32
I have't worked with the graphs on SSRS much, but when I try to convert to time or minutes it either doesn't change, or is just changed to HH:MM:SS and doesn't actually display anything.
Any help on the matter would be great.
Shortly after posting this I figured it out.
I converted the duration to Time(0) within the SP, and displayed the un-Aggregated version of the duration on the bar.
Then right clicked the vertical axis > properties > Number.
Then changed the Custom to HH:mm.
Is now properly displaying it as 00:20 up the side.

VB .net datetimepicker reporting wrong value

Ok, so I'm experiencing some strange behavior in datetimepicker fields in my program. I use Short format usually, and use a pair of them for date range selections.
The problem i'm experiencing is if a user is using the keyboard for input. they can tab and arrow through the field like normal to key in a date. However if the date part they are entering doesn't fill it's section of the mask and then they press enter to activate the formdefault without shifting focus away from that portion of the date, then the value of the DTP when the ok_button.click event is run is whatever value it had in it BEFORE they typed their change.
to give a specific example:
A user tabs into the date field. the default date in the field is today's date, 4/14/2015. They type in 1, arrow to the day, put in 1, then arrow to the year and type 14, then press enter. The reported value of the DTP is going to be 1/1/2015. Had they instead actually typed out 2015, or used the arrow to move to another date part or tab to shift focus to another control, the DTP will auto update to fill in the rest of the year.
The same problem would exist if they had typed in a 1 for the month and then hit enter, but would NOT happen if they put in a 12 for the month.
The only solution I can think of, and I haven't yet tried to implement it because it sounds like a real kludge and would require me to go through at TON of forms in the project, would be to change the keypress event for enter to shift focus to the OK button, and THEN invoke the formdefault.
I will say that most of the datetimepicker fields on my forms are actually contained within a user control, so if this is a property that can be changed in the control or tied to an event in the control, it would make updating much, MUCH easier.

VB time input, a better way to do it?

Working on a handy program for my boss at work as a summer project in between semesters both to make life easier for her, and to practice and improve my skills. Intent is to allow her to quickly and easily calculate the hours and minutes the person worked. The form itself has a series of text boxes for the Clock in and Clock out time for each day that week. Currently it attempts to convert the txtbox text into a Date variable, then .Subtract()'s the start from the end and stores it in a rolling total variable which is displayed at the bottom of the form. I can't help but think there is a better way of going about doing this, and I'm absolutely certain that having the below block of code 21 times (7 days, 3 shifts) is inefficient.
Dim StartTime As Date
Dim EndTime As Date
Dim Worked As System.TimeSpan
Dim WorkedTotal As System.TimeSpan
If chkFirst.Checked = True Then
StartTime = CDate(txtMonStart.Text)
EndTime = CDate(txtMonEnd.Text)
EndTime = EndTime.AddHours(12)
Worked = EndTime.Subtract(StartTime)
lblMonWork.Text = Worked.ToString()
WorkedTotal += Worked
Currently it works, mostly. The user has to enter the ":" in the time input, and if the total exceeds 24 hours, it displays a day column (40 hour 12 min work week displays as 1.16:12). I'd like to eliminate both of these unplanned features and allow for my input validation to take place when the focus changes to another box. A changing bgcolor would indicate an invalid input.
Any bright ideas?
Instead of using TextBox for the time input, use DateTimePicker, just change the Format property to Time.
Handle the Validating event of the DateTimePicker and if it's invalid just set e.Cancel = False, that way they can't save changes unless it's valid. Or if you want them to be able to leave the DateTimePicker and just change the colour, just handle the ValueChanged event instead.
Regarding your code sample, I haven't really looked at the logic of it, but instead of having the same code 21 times, just move the code into a separate function and then call that function with the start and end times as parameters and it can return the workedtime as it's return value.
I'm not sure what your UI looks like but if you're repeating the start time and end time input control multiple times as well it might be worth looking at creating your own usercontrol that can contain one each of the start and end time controls, and then you could have the validation be inside that user control so you don't have to have lots of event handlers etc.