Time 08.00 in stead of 08:00?

H

Harmannus

Hallo,

How can i display the time (on a form or report) as 08.00 (with a dot) in
stead of 08:00?

Tried various format([starttime],"00.00") variations but none work. Using
the dot in a format turns it into a number 0.000....

Thanx for any tips!


Regards,

Harmannus
 
A

Albert D. Kallal

It is not clear if you need 12, or 24 hour format.

You could build a global function, and use everywhere for forms, reports
etc.

That function could be:

Public Function MyTimeFormat(dtTime As Variant) As String

If IsNull(dtTime) = False Then
MyTimeFormat = Left(Format(dtTime, "HHAMPM"), 2) & "." &
Format(dtTime, "mm")
End If

End Function

So, for any reprot, or form, you can go:

=MyTimeFormat([YourTimeFieldGoesHere])

If you need 24 hours, and not 12 based, then simply simply change:

Format(dtTime, "HHAMPM")

to:

Format(dtTime, "HH")

The above also means you can remove the use of the "left" functin also.
 
D

Dirk Goldgar

Harmannus said:
Hallo,

How can i display the time (on a form or report) as 08.00 (with a
dot) in stead of 08:00?

Tried various format([starttime],"00.00") variations but none work.
Using the dot in a format turns it into a number 0.000....

Thanx for any tips!

One possibility would be to apply the Replace() function after the
Format() function, like this:

=Replace(Format([StartTime], "hh:nn"), ":", ".")
 
H

Harmannus

Hallo,

Replace works great ;-)

Thanx a lot!

Happy Newyear!

Regards,

Harmannus


Dirk Goldgar said:
Harmannus said:
Hallo,

How can i display the time (on a form or report) as 08.00 (with a
dot) in stead of 08:00?

Tried various format([starttime],"00.00") variations but none work.
Using the dot in a format turns it into a number 0.000....

Thanx for any tips!

One possibility would be to apply the Replace() function after the
Format() function, like this:

=Replace(Format([StartTime], "hh:nn"), ":", ".")

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
P

Paul Overway

Format([StartTime],"hh.nn")

No need for Replace...just change the delimiter.

--
Paul Overway
Logico Solutions, LLC
www.logico-solutions.com


Dirk Goldgar said:
Harmannus said:
Hallo,

How can i display the time (on a form or report) as 08.00 (with a
dot) in stead of 08:00?

Tried various format([starttime],"00.00") variations but none work.
Using the dot in a format turns it into a number 0.000....

Thanx for any tips!

One possibility would be to apply the Replace() function after the
Format() function, like this:

=Replace(Format([StartTime], "hh:nn"), ":", ".")

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Dirk Goldgar

Paul Overway said:
Format([StartTime],"hh.nn")

No need for Replace...just change the delimiter.

By golly, you're right! I had assumed that wouldn't work.
 
A

Albert D. Kallal

Nice...and I did not really realize your solution would work!

I was about to give Dirk a high five for coming up with such a ingenious
solution by using the replace command!

While I still admire Dirk's solution, I would have to award you the prize
here!
 
P

Paul Overway

FYI...you can use just about any character...as long as it would not be
evaluated by Format. If it isn't evaluated by Format, it is used in the
result as a literal in the position indicated in your argument.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top