How to automatically get correct time/clock

Questions related to using nuBuilder Forte.

How to automatically get correct time/clock

Postby ingar » Mon May 20, 2019 9:19 pm

Hello everybody,

Since my first post a couple weeks ago, my database crashed completely (mysql-database) ... so, I had to start all over again with my little project.

I'm making a small customer phone-call logging system (when a customer calls, I'm recording data about what the call was all about).

In my subform, I have a need for an automatic value for correct time of my registration of the call. I'm talking about the clock-time "right now" (as when I'm actually saving the record/row).
I have tried using default value "CURRENT_TIMESTAMP" in phpMyadmin for this date-column ... but this clock timestamp always lags behind with somewhere 20 - 30 minutes (wrong time).

Is it possible to have an automatic "fill-in" of current realtime clock in my field named "tidspunkt" (='time') ... and ONLY doing so when it's a NEW ROW (new record) in my subform?

I've tried screaming at the application and hammering on the keyboard ....it didn't do any good ;)

Here's an image of my form with the subform, and tablestructure of the phonelog:

Image
ingar
 
Posts: 10
Joined: Mon May 06, 2019 5:01 pm

Re: How to automatically get correct time/clock

Postby Janusz » Tue May 21, 2019 3:36 am

Hi,
You can use timestamp.
As example please find enclosed a screen shot from my table.
https://drive.google.com/open?id=1_aEgM ... 8UFxopm2hw

Generally I use 4 fields for tracking every record - 2 for creation (name and date) and the same for update.
Date is fully managed by database and names are sent by nuBuilder.
This works very well without any delay with very good time precision:
https://drive.google.com/open?id=118bx5 ... JmtImKn30i

Additionally I checked with the subform - and works fine with no issuse.
Maybe someone is entering data to the subform and not pressing the save button just after but wating some time - date is updated after save operation.
For example you can add small save button as in attached example:
https://drive.google.com/open?id=1mnd2w ... lIGHS1PCIh
Last edited by Janusz on Tue May 21, 2019 4:26 am, edited 1 time in total.
Janusz
 
Posts: 259
Joined: Fri Dec 28, 2018 10:11 pm
Location: Krakow, Poland

Re: How to automatically get correct time/clock

Postby ingar » Tue May 21, 2019 4:23 pm

Thank you for your kind help and tips... I altered the field (column) as shown in your example. I only need the timestamp of when the call was made. Or to be more precise: when the phonecall log info was entered and saved the first time.

But still ... the TIME (hour:minute) is still OFF with 15 - 30 minutes compared with the actual time I edited and saved a new record. Editing and saving a new record takes only about 1-6 minutes most of the times. See the image below of what happened when i tried after the change of table in phpMyadmin:

Image

After this example shown above ... I did a new entry in the subform at the actual clock time 08:39 ... but after SAVING, it shows the time "08:05". And the time spent from searching the customer, opening the customer details form, talking with the customer, and finally entering into the subform (phonecall log) ..it took only about 5-6 minutes.

So ... there's definitely something I don't understand about this...
ingar
 
Posts: 10
Joined: Mon May 06, 2019 5:01 pm

Re: How to automatically get correct time/clock

Postby kev1n » Tue May 21, 2019 4:28 pm

Hi, could it be that the time on the server is off by x minutes?

You can easily test it by running this query:

select_now.png
select_now.png (14.36 KiB) Viewed 497 times
kev1n
 
Posts: 362
Joined: Mon Oct 15, 2018 2:13 am

Re: How to automatically get correct time/clock

Postby ingar » Tue May 21, 2019 4:41 pm

Hi again,

The sql-query gave this result:

Image

So it seems that the server's time is correct. Can't see what I've overlooked :o
ingar
 
Posts: 10
Joined: Mon May 06, 2019 5:01 pm

Re: How to automatically get correct time/clock

Postby Janusz » Tue May 21, 2019 5:01 pm

you can try add a row with phpmyadmin (to the suborm table directly) to see if the time is properly entered by database itself.
Janusz
 
Posts: 259
Joined: Fri Dec 28, 2018 10:11 pm
Location: Krakow, Poland

Re: How to automatically get correct time/clock

Postby ingar » Tue May 21, 2019 10:41 pm

Ok,

Now I tried to add a row directly into the table (subform), and got same result as shown below. I don
t know:

Image

So .. could it be a problem with the server, which is running on the same computer I'm working on?
It runs only as a "localhost", and the screenshots of the Windows clock is from the same computer/server.
ingar
 
Posts: 10
Joined: Mon May 06, 2019 5:01 pm

Re: How to automatically get correct time/clock

Postby ingar » Wed May 22, 2019 5:03 am

I found out something... The column in the subform ('tidspunkt' = date & time) was set as nuDate Input type:

Image

And this formatting is causing this situation as it SHOWS the time different than the timevalue it's actually stored as in the table. When I set the Input type to "Text" - it shows the time correctly. Sorry, my lack of knowledge led me to use nuDate as Input type.

NOW with Input type "Text", it sadly enough shows the date the wrong (for me) way. It shows the date in this format "YYYY-mm-dd" ... would need it in this format instead: "dd-mm-yy", but can't find a way to do it.
ingar
 
Posts: 10
Joined: Mon May 06, 2019 5:01 pm

Re: How to automatically get correct time/clock

Postby admin » Wed May 22, 2019 6:41 am

ingar,

You need to use nn for minutes (mm is months)


Steven
admin
Site Admin
 
Posts: 3162
Joined: Mon Jun 15, 2009 9:53 am

Re: How to automatically get correct time/clock

Postby ingar » Wed May 22, 2019 3:29 pm

:oops: :oops: :oops: I totally misunderstood the "mm", thinking it was "minutes"... My head was under my arm in this case :oops: Sorry.... now I'm gonna dig a hole in the ground...

Thank you Steven for your kind help ... and thank you all that did such an effort trying to help me out!

-Ingar
ingar
 
Posts: 10
Joined: Mon May 06, 2019 5:01 pm

Next

Return to General