Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / January 2006

Tip: Looking for answers? Try searching our database.

Time/Date Functions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pamela - 09 Jan 2006 12:40 GMT
This is probably a simple question...all I want to do is to display the
current date & time (Now()), but just the numbers.  For example, 01/01/2006
09:20:33 AM would be 01012006092033

Is there an existing function for this. I looked around a bit but didn't find
one that does this.  

Thanks.
Rick Brandt - 09 Jan 2006 12:50 GMT
> This is probably a simple question...all I want to do is to display
> the current date & time (Now()), but just the numbers.  For example,
[quoted text clipped - 4 lines]
>
> Thanks.

Just use a format property of...

mmddyyyyhhnnss

Signature

I don't check the Email account attached
to this message.     Send instead to...
RBrandt    at       Hunter      dot      com

Pamela - 09 Jan 2006 13:18 GMT
Kewl!  Found the Format function in MS Help after I posted.  
Thanks!  
strDateTime = Format(Now(), "mmddyyyyhhnnss") did the trick.  :)  

Still becoming familiar with VB functions.

>> This is probably a simple question...all I want to do is to display
>> the current date & time (Now()), but just the numbers.  For example,
[quoted text clipped - 5 lines]
>
>mmddyyyyhhnnss
Rick Brandt - 09 Jan 2006 15:23 GMT
> Kewl!  Found the Format function in MS Help after I posted.
> Thanks!
> strDateTime = Format(Now(), "mmddyyyyhhnnss") did the trick.  :)
>
> Still becoming familiar with VB functions.

There is a distinction that needs to be made here.  What I suggested was
using the format *Property*.  That gives you the desired display, but the
underlying data is still a date and it will be treated like a date for
sorting and comparisons.

The Format() *Function* which is what you used actually takes the date and
transforms it into a string in the output so now the field will act like a
string when it comes to sorting and comparisons.  You have to take this
difference into account when you are choosing between the two methods.

Also, when using a format property the field will still be editable.  If you
use the Format() function it will not be.

Signature

I don't check the Email account attached
to this message.     Send instead to...
RBrandt    at       Hunter      dot      com

Pamela - 09 Jan 2006 15:40 GMT
That's what I figured...

I knew how to use the format property for fields & controls on forms, it was
the VB code for converting a date & time I was looking for as I needed to use
it to append to the beginning of imported email attachment filenames to make
them unique.  Your suggestion led me to look at using format in Visual Basic,
so thanks!  :-)

>> Kewl!  Found the Format function in MS Help after I posted.
>> Thanks!
[quoted text clipped - 14 lines]
>Also, when using a format property the field will still be editable.  If you
>use the Format() function it will not be.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.