Custom format using time

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

Guest

Using Office 2003 and Windows XP;

I would like to return the time in a variable in AM/PM format, but without
the AM/PM in the string.

Ideally, for example if it is now 4:42 PM (or AM - this does not matter) my
function would return: 0442

Can someone help me out with this?

Thanks.
 
XP said:
Using Office 2003 and Windows XP;

I would like to return the time in a variable in AM/PM format, but
without the AM/PM in the string.

Ideally, for example if it is now 4:42 PM (or AM - this does not
matter) my function would return: 0442

Can someone help me out with this?

Thanks.

Left(Format(Now(), "hhnn ampm"), 4)

You need the ampm even though you end up clipping it off to avoid military
hours.
 
Back
Top