Topic: textBox date time format

hello MVD friends ,

i'm new here and need your help

i want to change textbox default format to time , when i open the form it apear like this : 00:00 ( hh : mm )

any body have any idea how to do that ?

Re: textBox date time format

Hi,
Is there a particular reason why you are using a textbox instead of a datetimepicker to hold the time?
Derek.

Re: textBox date time format

Yes i want to calculate the diff between two times , i use DatetimePicker but it have this format ( hh : mm : ss ) i don't like the 'ss' , and also when i want to make diff between these two times i had an result not perfect , for exemple :
10:00 - 11:00 = 00:59 and not 01:00 , the difference between these times is 01 hour , and it give me 59 min , i don't know why !
and also it appear the default  system time , i want it to appear 00:00 as default when i open the form

Re: textBox date time format

You can edit the property of the time picker on the left side, Kind= time, Format= hh:mm for 12 hours, HH:mm for 24 hours so no seconds will be displayed.

Re: textBox date time format

what is your formula for the time diff?

Re: textBox date time format

Hi,
It's not clear from your post if you need to consider whether the time range spans more than 1 day (in which case you need to use both date and time rather than just time),  whether the 'to' date/time is always greater than the 'from' date/time etc.
However, as a basic suggestion, have a look at the attachment.
Derek.

Post's attachments

Attachment icon time between.zip 443.74 kb, 135 downloads since 2023-12-26 

Re: textBox date time format

Hello
Thanks Derek
I want to sum Three numbers in timing
Like this
113:20 + 100:10 = 213:30
Have you any idea how can i do that?

Re: textBox date time format

Hi all

Encode
Convert hours to seconds(*3600),
convert minutes to seconds(*60).
Add everything you calculated with seconds.(Time1 := H * 3600 + M * 60 + S)
Do this every time and add more. TimeAll := Time1 + Time2 + timeN.
Decode
Now we take the integer from division (TimeAll / 3600). It's an hour.
We divide the remainder of the division (TimeAll mod 3600) by 60. The integer part of the division is minutes.
The remainder of division by 60 (((TimeAll mod 3600) mod 60) is the seconds remaining.

Re: textBox date time format

How can I sum three time values, for example, 113:20 + 100:10 = 213:30? Can you provide a step-by-step approach or formula for achieving this in MVD, considering the conversion of hours and minutes to seconds for accurate calculations?

smile

Re: textBox date time format

Those numbers are anything but time values. Do you have a project you could send?

Re: textBox date time format

Hi Kneeme,
It's more usual to use datetimepicker fields to add up times and then display the result in days, hour, minutes (and seconds, if required).
However, if you must use edit fields, I would use discrete edit fields for hours, minutes and seconds as per the attached example.
Obviously you could use just one edit field to hold hours, minutes and seconds but this makes things more complicated when you come to substring the edit field into its hours, minutes and seconds components.  Specifically
- how do you want the user to input the values - free-hand or with edit masks?
- do you force 2 digits for minutes and seconds?
- what is the maximum digits that the hours can go up to?
etc etc
Derek.

Post's attachments

Attachment icon calculate hours mins and secs.zip 343 kb, 137 downloads since 2024-01-05 

Re: textBox date time format

Newbie here!

Not sure if could help, but I had a similar trouble, Calculate the left days for the row date, starting "today" (days left for a Domain Date Expiration)

All fields are DATE fields (no time) and I used next query to get the difference between the date in the row and "today"

JULIANDAY("Date Expire") - JULIANDAY()    

Where:
- ("Date Expire") are field name with future date
- () takes today date. You can fill with other field to get difference between both
* To show integer value (without decimals), put "Accuracy" value to 0 in TextBox properties

Buuut can not show result value in a gridview, because only can be seen in textbox
2 NOTE: my TableGrid are around 1100 lines = date differences to calculate

Re: textBox date time format

Hi,
Not quite sure what your issue is with displaying 'days left' in a tablegrid;  there are a number of ways to do this. 
Have a look at the attachment as one option and get back if anything is unclear.
The 'days left' and 'duration days' are actually displayed in the caption of Form2 instead of in text fields (simply because it's something that the user does not have direct input to) but the text fields are just hidden so if you prefer to display it that way, just make them visible again.
NB:  the actual calculation of 'days left' and 'duration' varies depending on whether your date range is 'inclusive' or 'exclusive' but this is just your own preference - the principle remains the same.
Regards,
Derek.

Post's attachments

Attachment icon expiry date.zip 453.1 kb, 93 downloads since 2024-04-25