Now function

​Dear All,
I have used now() function in an app expecting the Date and time but I only
get the Date. I have a Hidden value called RegistrationDateAndTime and on
the Calculate Condition I have now().

In fact, I am testing it using the Show App Preview. Could this be the
reason?

Yaw

Hi Yaw,

Unfortunately our support for time-stamps is a bit limited in the system.

If you want to save the date and time, you can do so with the expression

concat(format-date(now(), ‘%Y-%m-%d’),‘T’,format-date(now(),’%H:%M:%S’))

to get a timestamp like: 2017-04-18T14:55:17Z

but be aware that the use of format-date() with time data has some tricky
limitations.

-Clayton

··· On Tue, Apr 18, 2017 at 9:31 AM, YAW ANTWI-ADJEI wrote:

​Dear All,
I have used now() function in an app expecting the Date and time but I
only get the Date. I have a Hidden value called RegistrationDateAndTime and
on the Calculate Condition I have now().

In fact, I am testing it using the Show App Preview. Could this be the
reason?

Yaw


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Clayton,
Thank you again for your support but please what are some of the tricky
limitations? What I want to do is to record the Date and Time that a
patient came to the clinic and then together with his/her folder number I
can have unique ID for the visits that a patient will make within a
particular day.

The other option I can think off is to capture Time of Visit and then
compare with the system. My problem with this option is how to extract the
Time from the now() function. If there is a way that I can extract the time
indeed I shall prefer that.

Yaw​

··· On 18 April 2017 at 14:57, Clayton Sims wrote:

Hi Yaw,

Unfortunately our support for time-stamps is a bit limited in the system.

If you want to save the date and time, you can do so with the expression

concat(format-date(now(), ‘%Y-%m-%d’),‘T’,format-date(now(),’%H:%M:%S’))

to get a timestamp like: 2017-04-18T14:55:17Z

but be aware that the use of format-date() with time data has some tricky
limitations.

-Clayton

On Tue, Apr 18, 2017 at 9:31 AM, YAW ANTWI-ADJEI yawantwiadjei@gmail.com wrote:

​Dear All,
I have used now() function in an app expecting the Date and time but I
only get the Date. I have a Hidden value called RegistrationDateAndTime and
on the Calculate Condition I have now().

In fact, I am testing it using the Show App Preview. Could this be the
reason?

Yaw


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Yaw:

You can use any of the options in the format-date function listed here:
https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions

as long as you use them with the direct now() input and not a reference
to a question or hidden value.

for instance you could format the hidden value:

format-date(now(), ‘%H:%M’)

To get an output like 16:23

-Clayton

··· On Tue, Apr 18, 2017 at 11:07 AM, YAW ANTWI-ADJEI wrote:

Hi Clayton,
Thank you again for your support but please what are some of the tricky
limitations? What I want to do is to record the Date and Time that a
patient came to the clinic and then together with his/her folder number I
can have unique ID for the visits that a patient will make within a
particular day.

The other option I can think off is to capture Time of Visit and then
compare with the system. My problem with this option is how to extract the
Time from the now() function. If there is a way that I can extract the time
indeed I shall prefer that.

Yaw​

On 18 April 2017 at 14:57, Clayton Sims csims@dimagi.com wrote:

Hi Yaw,

Unfortunately our support for time-stamps is a bit limited in the system.

If you want to save the date and time, you can do so with the expression

concat(format-date(now(), ‘%Y-%m-%d’),‘T’,format-date(now(),’%H:%M:%S’))

to get a timestamp like: 2017-04-18T14:55:17Z

but be aware that the use of format-date() with time data has some tricky
limitations.

-Clayton

On Tue, Apr 18, 2017 at 9:31 AM, YAW ANTWI-ADJEI <yawantwiadjei@gmail.com wrote:

​Dear All,
I have used now() function in an app expecting the Date and time but I
only get the Date. I have a Hidden value called RegistrationDateAndTime and
on the Calculate Condition I have now().

In fact, I am testing it using the Show App Preview. Could this be the
reason?

Yaw


You received this message because you are subscribed to the Google
Groups “commcare-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Clayton,
That works. Thank you very much.

Yaw​

··· On 18 April 2017 at 16:21, Clayton Sims wrote:

Hi Yaw:

You can use any of the options in the format-date function listed here:
https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions

as long as you use them with the direct now() input and not a reference
to a question or hidden value.

for instance you could format the hidden value:

format-date(now(), ‘%H:%M’)

To get an output like 16:23

-Clayton

On Tue, Apr 18, 2017 at 11:07 AM, YAW ANTWI-ADJEI <yawantwiadjei@gmail.com wrote:

Hi Clayton,
Thank you again for your support but please what are some of the tricky
limitations? What I want to do is to record the Date and Time that a
patient came to the clinic and then together with his/her folder number I
can have unique ID for the visits that a patient will make within a
particular day.

The other option I can think off is to capture Time of Visit and then
compare with the system. My problem with this option is how to extract the
Time from the now() function. If there is a way that I can extract the time
indeed I shall prefer that.

Yaw​

On 18 April 2017 at 14:57, Clayton Sims csims@dimagi.com wrote:

Hi Yaw,

Unfortunately our support for time-stamps is a bit limited in the system.

If you want to save the date and time, you can do so with the expression

concat(format-date(now(), ‘%Y-%m-%d’),‘T’,format-date(now(),’%H:%M:%S’))

to get a timestamp like: 2017-04-18T14:55:17Z

but be aware that the use of format-date() with time data has some
tricky limitations.

-Clayton

On Tue, Apr 18, 2017 at 9:31 AM, YAW ANTWI-ADJEI < yawantwiadjei@gmail.com> wrote:

​Dear All,
I have used now() function in an app expecting the Date and time but I
only get the Date. I have a Hidden value called RegistrationDateAndTime and
on the Calculate Condition I have now().

In fact, I am testing it using the Show App Preview. Could this be the
reason?

Yaw


You received this message because you are subscribed to the Google
Groups “commcare-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google
Groups “commcare-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.