Hi again...
I need to know how I can capture the current time in a field of a subform with the onchange event in the scripting. I can manage to do it with a particular date, but when I try with the time, it only displays 00:00.
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
The time in a subform
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: The time in a subform
Hi,
How are you currently retrieving the value? To better assist you, could you please share some code that demonstrates your approach?
How are you currently retrieving the value? To better assist you, could you please share some code that demonstrates your approach?
-
- Posts: 27
- Joined: Thu Sep 01, 2022 3:42 am
- Has thanked: 1 time
Re: The time in a subform
Hi Kevin, how are you doing?
I have a subform with a field called 'hora' and in it I put the following code:
Then the field only shows the date but without the current time, as seen in the following image:
I have a subform with a field called 'hora' and in it I put the following code:
Then the field only shows the date but without the current time, as seen in the following image:
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: The time in a subform
nuSetDateValue() is used to update the value of a specified object with a date (excluding the time component) in a specific format.
What format is used for "Hora" - Is it text or Datetime-local?
What format is used for "Hora" - Is it text or Datetime-local?
-
- Posts: 27
- Joined: Thu Sep 01, 2022 3:42 am
- Has thanked: 1 time
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: The time in a subform
Untested:
Code: Select all
const now = new Date();
const formattedDate = now.toISOString().slice(0, 16);
nuSetValue(this.id, formattedDate);
-
- Posts: 27
- Joined: Thu Sep 01, 2022 3:42 am
- Has thanked: 1 time
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
-
- Posts: 27
- Joined: Thu Sep 01, 2022 3:42 am
- Has thanked: 1 time