Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Special TIMESTAMP - 0912291327

20 views
Skip to first unread message

robboll

unread,
Dec 29, 2009, 2:51:52 PM12/29/09
to rpbol...@sbcglobal.net
In trying to come up with a VBA timestamp for 2 digit year, month day
and 24 hr time, I came up with the following code. IT WORKS!

? mid(year(date()),3,2) & month(date())&day(date()) & replace
(FormatDateTime(Now, vbShortTime),":","")
0912291327

You can leave off the mid function if you want a full year. I just
thought the 2 digit year would suffice.

? year(date()) & month(date())&day(date()) & replace(FormatDateTime
(Now, vbShortTime),":","")
200912291339

While I was doing this I thought I'd try to scour the net to see if
there is a cleaner/sweeter way to do it.

Any suggestions out there?

RBollinger

Marshall Barton

unread,
Dec 30, 2009, 9:27:16 AM12/30/09
to
robboll wrote:


IMO, that will not work for the first 9 days of any month
nor for the first 9 months in a year. E.g. 1 Jan 2010 will
come out as 10111327 and you'll never be able figure out
what is what without the month and day leading zeros.

It is way better to just leave the table field as a
Date/Time field and set it to Now. Then, whenever you want
to display it in a form or report for users that like seeing
that compressed style of timestamp, use a text box with
custom format of yymmddhhnn

--
Marsh

bobh

unread,
Jan 6, 2010, 3:49:23 PM1/6/10
to

for creating a date/time stamp I use this
MyRec!DTStamp = Format(Date(), "mmddyy") & Format(Time(), "hhnnss")

bobh.

Terry Kreft

unread,
Jan 31, 2010, 4:46:40 AM1/31/10
to
format(now, "yymmddhhnnss")

or
format(now, "yymmddhhnn")

if you don't want seconds

--
Terry Kreft


"bobh" <vulc...@yahoo.com> wrote in message
news:7fb8262b-b87d-4094...@21g2000vbh.googlegroups.com...

0 new messages