# time format problem

**URL:** <https://forum.servoy.com/t/time-format-problem/10102>\
**Category:** Classic Servoy\
**Created:** [January 8, 2009, 10:37am UTC](https://forum.servoy.com/t/time-format-problem/10102 "2009-01-08T10:37:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [January 8, 2009, 10:37am UTC](https://forum.servoy.com/t/time-format-problem/10102/1 "2009-01-08T10:37:19Z")

</div>

Hi there,

I want to make typing times, easier for our customers,

I had a timefield, with this format: HH:mm  
now they always have to type the ‘:’ which is not handy, so I thought I try this format: HH:mm|HHmm

but now, this only works for 1000 and higher (which becomes 10:00)  
if I type: 830, I want it to become: 8:30, Servoy makes it: 11:00 ![:-(]( "Sad")

so I thought I make the format: HH:mm|Hmm  
and than it works for 830 (servoy makes it 8:30) but I does not work anymore for everything higher than 1000.  
for instance if I fill in: 1010, servoy makes it: 01:10 ![:-(]( "Sad")

anyone seen this or fixed this???

another problem I have seen, as soon as I use a format: like this: HH:mm|HHmm  
my custom valuelist on the same field (editable combobox) is not working anymore, it is empty

Here is my customer valuelist:  
00:00  
00:15  
00:30  
00:45  
01:00  
01:15  
01:30  
01:45  
02:00  
etc…  
etc…

I have tried to make the valuelist like this:  
0000  
0015  
0030  
0045  
0100  
0115  
0130  
0145  
0200  
etc…  
etc…

but that does not work either…  
the strange this is that as soon as I use on 1 field this format: HH:mm|HHmm the valuelist does not work anymore, on any other timefield, (which has still a format: HH:mm)  
I’m using Servoy 3.5.7\_01 right now and Java 6 u11 on Windows XP

Hope someone can help me out here

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [January 8, 2009, 10:47am UTC](https://forum.servoy.com/t/time-format-problem/10102/2 "2009-01-08T10:47:00Z")

</div>

What happens when you do this: ‘HH:mm|’ (without quotes)

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [January 8, 2009, 11:00am UTC](https://forum.servoy.com/t/time-format-problem/10102/3 "2009-01-08T11:00:55Z")

</div>

nothing,

than I can’t type: 1000 I MUST type the ‘:’ so like this: 10:00  
and the valuelist is also still broken.

---

<div class="post-metadata">

**Author:** ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)\
**Post date:** [January 8, 2009, 12:14pm UTC](https://forum.servoy.com/t/time-format-problem/10102/4 "2009-01-08T12:14:24Z")

</div>

Maybe the converter format is a solution for you?

See: [viewtopic.php?f=22&t=11684](http://forum.servoy.com/viewtopic.php?f=22&t=11684)

Paul

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [January 8, 2009, 12:22pm UTC](https://forum.servoy.com/t/time-format-problem/10102/5 "2009-01-08T12:22:31Z")

</div>

oke, i will go further there, for the inut syntax, but that does not solve my issue, why the valuelist breaks, when I use a format: HH:mm|HHmm

thanks.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [April 29, 2009, 10:19am UTC](https://forum.servoy.com/t/time-format-problem/10102/6 "2009-04-29T10:19:08Z")

</div>

that your valuelist doesnt work for HHmm or Hmm is pretty logical

for Hmm the 1100 cant be parsed because there is 1 char to much  
for HHmm the 830 can be parsed but parsing happens from the front not the back  
so first H maps on 8, second H on 3 and m on 0 and then the last m on nothing (so you are saying 8300)  
then you get those auto conversions and you get things like 11:00 or what ever the rollover hours are.

You can do what you want with the global converter on that time field make these 2 global methods:

```auto
function fromObject(object)
{
	if (object.length == 3)
	{
		return utils.dateFormat(object,"Hmm");
	}
	else if (object.length == 4)
	{
		return utils.dateFormat(object,"HHmm");
	}
	else
	{
		throw "Not supported input " + object;
	}
	return object;
}

funnction toObject(object)
{
	return utils.dateFormat(object,"HHmm");
}

```

then place a field and set the format to converter
