App Connect Data Formatter Support Product Page

Answered

How do I format a database time field?

Asked 10 Jul 2017 13:35:51
2
have this question
10 Jul 2017 13:35:51 Andre Bender posted:
I have a time field in my database that stores the time in this format: 17:00:00. Now I'd like to format it in order to show up like this: 17:00

I tried: {{ZeitVon.formatDate("HH:mm"}} but this is not returning any values.

Replies

Replied 16 Jul 2017 16:41:10
16 Jul 2017 16:41:10 Brad Lawryk replied:
Yes, I am still waiting for the ability to format a time field as well. Thought that would have been in there but it isn't.
Replied 17 Jul 2017 07:28:15
17 Jul 2017 07:28:15 Teodor Kuduschiev replied:
Hi Andre, Brad,

An update for the formatter is coming on wednesday, it will allow you to format time fields like:


{{time.formatDate("H:mm")}}



Which will format your time like: 17:00
Replied 17 Jul 2017 12:45:04
17 Jul 2017 12:45:04 Brad Lawryk replied:
Perfect, thanks
Replied 19 Jul 2017 15:50:58
19 Jul 2017 15:50:58 Teodor Kuduschiev replied:
Please update the formatter to the latest version, and you will be able to format the time field values, as described above.
Replied 19 Jul 2017 15:53:21
19 Jul 2017 15:53:21 Andre Bender replied:
Thanks Teodor
Replied 19 Jul 2017 15:57:23
19 Jul 2017 15:57:23 Brad Lawryk replied:
I only see a convert to ISO Time? I do not see a format time option anywhere?
Replied 19 Jul 2017 16:14:24
19 Jul 2017 16:14:24 Brad Lawryk replied:
{{shopStartTime.formatDate("H:mm"}} for example still not returning any values ....
Replied 20 Jul 2017 06:28:28
20 Jul 2017 06:28:28 Andre Bender replied:
Please add "today" as a value to be selected.
Replied 20 Jul 2017 07:05:44
20 Jul 2017 07:05:44 Teodor Kuduschiev replied:
Hi Andre,
There's already a datetime component in App Connect, which allows the usage of current date AND time.


Added to the app connect tree, later it can be called to compare it with your dynamic dates for example, or to create a countdown timer. You can choose the interval, which is useful for countdowns:
Replied 20 Jul 2017 07:33:13
20 Jul 2017 07:33:13 Andre Bender replied:
Thanks Teodor. Didn't thought of adding a date var in the App Structure first. :-)
Replied 20 Jul 2017 10:46:33
20 Jul 2017 10:46:33 Brad Lawryk replied:
What about the ability to format a time field? Where is it?
Replied 20 Jul 2017 11:01:42
20 Jul 2017 11:01:42 Teodor Kuduschiev replied:
Well, it is where all the formats are:

Replied 20 Jul 2017 11:38:12
20 Jul 2017 11:38:12 Brad Lawryk replied:
That still does not return any value. Adding a date format that way makes the entire date disappear and not show anything.
Replied 20 Jul 2017 11:47:49
20 Jul 2017 11:47:49 Teodor Kuduschiev replied:
Please provide a link to your page, and explain what exactly are you trying to format.
Replied 20 Jul 2017 11:50:48
20 Jul 2017 11:50:48 Brad Lawryk replied:
Hmmm, I think I know why. But not sure what is causing it.

In your screenshots, the time field is marked with a time icon indicating a time field. I don't get that. In mine the time field is still marked as a text field even though it is a time field in the database.
Replied 20 Jul 2017 12:05:25
20 Jul 2017 12:05:25 Brad Lawryk replied:
Yes, that is the problem. If I had the fields to my query one at a time I can change the field type to 'time'. If I had the whole table I don't have access to changing the field type in the query to 'time' and it isn't picking it up automatically.

Perhaps that is a bug?
Replied 20 Jul 2017 12:10:28
20 Jul 2017 12:10:28 Teodor Kuduschiev replied:
If your field is a time field, it will be recognized by app connect as a time field.
Not sure i understand what do you mean in your last post?
Replied 20 Jul 2017 12:14:13
20 Jul 2017 12:14:13 Brad Lawryk replied:
It isn't automatically recognizing it as a time field. I have to manually set that and even if I do set it it still doesn't work.

Setting up a test page now where you can see it.
Replied 20 Jul 2017 13:04:57
20 Jul 2017 13:04:57 Brad Lawryk replied:
Here you go .... a test page with screenshots of my UI as well.

184.70.224.218/sandbox/test_dateformat.php
Replied 20 Jul 2017 14:15:13
20 Jul 2017 14:15:13 Teodor Kuduschiev replied:
Please make sure to update the extensions to the latest version and try again, try re-creating the database connection also.
Also - what is your server type and what is the database type?
Replied 20 Jul 2017 14:19:10
20 Jul 2017 14:19:10 Brad Lawryk replied:
Everything is up to date. That was a new connection I just created for the test page.

Windows Server and MySQL.
Replied 20 Jul 2017 14:29:41
20 Jul 2017 14:29:41 Teodor Kuduschiev replied:
Is this a local testing server or is it a real, properly configured production server? What version of PHP are you using there?
Replied 21 Jul 2017 04:20:46
21 Jul 2017 04:20:46 Brad Lawryk replied:
Production server .... PHP Version 5.5.12
Replied 21 Jul 2017 07:00:27
21 Jul 2017 07:00:27 Teodor Kuduschiev replied:
Are you sure you are using the latest database connector and updater also?

Reply to this topic