Only use hours/minutes for time

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a date field which stores the time of an event (an appointment for
exampe). I am then including this field wihin the message body of a mail sent
via Outlook. At the moment the time is being passed as hh:mm:ss but I only
want hh:mm to be seen. Is this possible?
 
So - I have "Dim timPickupTime As Date" - what would my Format statement look
like? (The help seems to give examples of day, month etc. but not time) - or
do I need to change the input mask in Access (currently have it as 00:00;0;_)?
 
If timPickupTime is the variable containing the value you wanna format

format(timPickupTime,"hh:mm")

Cheers Paolo
 
Sure because the format function returns a value and with this value you have
to do something. For example save it (e.g.)

formatted_value=format(timPickupTime,"hh:mm")

otherwise you can display the formatted value (i.e.)

msgbox format(timPickupTime,"hh:mm")

Paolo
 
Brilliant! (Easy when you know how).

Paolo said:
Sure because the format function returns a value and with this value you have
to do something. For example save it (e.g.)

formatted_value=format(timPickupTime,"hh:mm")

otherwise you can display the formatted value (i.e.)

msgbox format(timPickupTime,"hh:mm")

Paolo
 
I have a date field which stores the time of an event (an appointment for
exampe). I am then including this field wihin the message body of a mail sent
via Outlook. At the moment the time is being passed as hh:mm:ss but I only
want hh:mm to be seen. Is this possible?

All you need do is format the field's data using a valid time format.
nn is the format indicator for minutes (not mm). See Access help!

To display hours and minutes only, set the control's Format property
to:
hh:nn

Or you can use, as a control source:
=Format([FieldName],"hh:nn")
 
Hi Fred,

actually the Access help states
"...If m immediately follows h or hh, the minute rather than the month is
displayed."

So in this case is correct also the format "hh:mm". (also more intuitive)

If just the minutes are required (without leading hours) you have to use n
or nn.

Cheers Paolo


fredg said:
I have a date field which stores the time of an event (an appointment for
exampe). I am then including this field wihin the message body of a mail sent
via Outlook. At the moment the time is being passed as hh:mm:ss but I only
want hh:mm to be seen. Is this possible?

All you need do is format the field's data using a valid time format.
nn is the format indicator for minutes (not mm). See Access help!

To display hours and minutes only, set the control's Format property
to:
hh:nn

Or you can use, as a control source:
=Format([FieldName],"hh:nn")
 
Back
Top