Time 08.00 in stead of 08:00?

  • Thread starter Thread starter Harmannus
  • Start date Start date
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
 
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.
 
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"), ":", ".")
 
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)
 
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)
 
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!
 
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.
 
Back
Top