Allen Browne's Calendar Date/Time & Minutes

  • Thread starter Thread starter Beeyen
  • Start date Start date
B

Beeyen

Good Day,

I am using the Pop-up calendar, which was so gracously provided by Mr
Browne. But I would like to add the current day and time with the date , if
possible when the date is selected. Assuming it is OK, Would anyone know how
this can be accomplished in the Calendar Design form.

Thanks
 
Hi Beeyen

You can simply add a pure time value (no date) to a pure date value (no
time) to give you the time of day on the given date.

It helps to know how date/time values are represented internally. They are
stored as a 64-bit floating-point number (same as a Double), where the
integer part represents the date and the fractional part represents the time
(as a fraction of 24 hours).

The integer date is the number of days after 30-Dec-1899 (or before, if it
is negative).

For example, 3.25 is 6am on 2-Jan-1900, because 2-Jan-1900 is 3 days after
30-Dec-1899, and 0.25 of 24 hours is 6 hours - hence 6am.

(You can verify this by typing ?CDate(3.25) into the immediate window.)

So given any date value (which could be a date returned from Allen's
calendar) you can add a time value to it. Assuming you have a Date variable
named "dt" which currently holds the value 30-Mar-2009, you could add the
time in a number of ways. For example:

dt + TimeValue("9:25 pm") - gives 30-Mar-2009 9:25:00 pm
dt + TimeSerial(21, 25, 0) - same result
dt + Time - gives the current time on 30-Mar-2009
dt + TimeValue(Now) - same result

Note that you can ensure you have a "pure" date or time value by using the
DateValue or TimeValue functions. DateValue will remove any time component
and TimeValue will remove any date component.
 
Good Day Mr Graham Mandeno,

Thank you for responding. While the message you present is clear, I am not
certain where within the design of the calendar the date and time should be
entered. I have tried a number of entries, including changing the format
field properties and when I select the day on the popup calendar the results
are the same. Can you assist?

Let me know

Thanks

Graham Mandeno said:
Hi Beeyen

You can simply add a pure time value (no date) to a pure date value (no
time) to give you the time of day on the given date.

It helps to know how date/time values are represented internally. They are
stored as a 64-bit floating-point number (same as a Double), where the
integer part represents the date and the fractional part represents the time
(as a fraction of 24 hours).

The integer date is the number of days after 30-Dec-1899 (or before, if it
is negative).

For example, 3.25 is 6am on 2-Jan-1900, because 2-Jan-1900 is 3 days after
30-Dec-1899, and 0.25 of 24 hours is 6 hours - hence 6am.

(You can verify this by typing ?CDate(3.25) into the immediate window.)

So given any date value (which could be a date returned from Allen's
calendar) you can add a time value to it. Assuming you have a Date variable
named "dt" which currently holds the value 30-Mar-2009, you could add the
time in a number of ways. For example:

dt + TimeValue("9:25 pm") - gives 30-Mar-2009 9:25:00 pm
dt + TimeSerial(21, 25, 0) - same result
dt + Time - gives the current time on 30-Mar-2009
dt + TimeValue(Now) - same result

Note that you can ensure you have a "pure" date or time value by using the
DateValue or TimeValue functions. DateValue will remove any time component
and TimeValue will remove any date component.
--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

Beeyen said:
Good Day,

I am using the Pop-up calendar, which was so gracously provided by Mr
Browne. But I would like to add the current day and time with the date ,
if
possible when the date is selected. Assuming it is OK, Would anyone know
how
this can be accomplished in the Calendar Design form.

Thanks
 
Hi Beeyen

If I understood your first question correctly, you wish the result from the
popup calendar to show not only the date, but also a time.

To do this, you would display the calendar first, then store the selected
date in a variable and then add the time to it.

--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

Beeyen said:
Good Day Mr Graham Mandeno,

Thank you for responding. While the message you present is clear, I am
not
certain where within the design of the calendar the date and time should
be
entered. I have tried a number of entries, including changing the format
field properties and when I select the day on the popup calendar the
results
are the same. Can you assist?

Let me know

Thanks

Graham Mandeno said:
Hi Beeyen

You can simply add a pure time value (no date) to a pure date value (no
time) to give you the time of day on the given date.

It helps to know how date/time values are represented internally. They
are
stored as a 64-bit floating-point number (same as a Double), where the
integer part represents the date and the fractional part represents the
time
(as a fraction of 24 hours).

The integer date is the number of days after 30-Dec-1899 (or before, if
it
is negative).

For example, 3.25 is 6am on 2-Jan-1900, because 2-Jan-1900 is 3 days
after
30-Dec-1899, and 0.25 of 24 hours is 6 hours - hence 6am.

(You can verify this by typing ?CDate(3.25) into the immediate window.)

So given any date value (which could be a date returned from Allen's
calendar) you can add a time value to it. Assuming you have a Date
variable
named "dt" which currently holds the value 30-Mar-2009, you could add the
time in a number of ways. For example:

dt + TimeValue("9:25 pm") - gives 30-Mar-2009 9:25:00 pm
dt + TimeSerial(21, 25, 0) - same result
dt + Time - gives the current time on 30-Mar-2009
dt + TimeValue(Now) - same result

Note that you can ensure you have a "pure" date or time value by using
the
DateValue or TimeValue functions. DateValue will remove any time
component
and TimeValue will remove any date component.
--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

Beeyen said:
Good Day,

I am using the Pop-up calendar, which was so gracously provided by Mr
Browne. But I would like to add the current day and time with the date
,
if
possible when the date is selected. Assuming it is OK, Would anyone
know
how
this can be accomplished in the Calendar Design form.

Thanks
 
Back
Top