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 / General 2 / February 2007

Tip: Looking for answers? Try searching our database.

now() format question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sjackson - 26 Feb 2007 19:53 GMT
to get a unique identifier i use the now() function and on the form it
displays like this "2007-02-26T11:46:57" but uses a 24 hour clock

is there a way to change the format?

i was trying to get auto numbering to work but even with a access database
it still wouldn't increment.  every form had the same number.

thanks,
Arvin Meyer [MVP] - 26 Feb 2007 20:51 GMT
The format would be:

yyyy-mm-dd hh:nn:ss AM/PM

I have no idea what the "T" is in your example. Also, I've never seen an
autonumber not work. Obviously, you haven't put a unique index on the field
because it is impossible to have a duplicate that is unique.
Signature

Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

> to get a unique identifier i use the now() function and on the form it
> displays like this "2007-02-26T11:46:57" but uses a 24 hour clock
[quoted text clipped - 5 lines]
>
> thanks,
Jamie Collins - 27 Feb 2007 14:24 GMT
> > to get a unique identifier i use the now() function and on the form it
> > displays like this "2007-02-26T11:46:57" but uses a 24 hour clock
>
> I have no idea what the "T" is in your example. Also, I've never seen an

It's one of the ISO 8601 representations. See:

http://en.wikipedia.org/wiki/ISO_8601

Jamie.

--
Arvin Meyer [MVP] - 28 Feb 2007 02:46 GMT
Ah. I see. Thanks.

So the answer is: There is no built in way to format the date/time as ISO
8601, but if one wanted to write some code, they could store it that way as
a text datatype, then for calculations, parse and convert it back to a
double or date/time datatype. Unless there's a specific requirement to do
so, I wouldn't bother.
Signature

Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

>> > to get a unique identifier i use the now() function and on the form it
>> > displays like this "2007-02-26T11:46:57" but uses a 24 hour clock
[quoted text clipped - 8 lines]
>
> --
Jamie Collins - 28 Feb 2007 08:16 GMT
> There is no built in way to format the date/time as ISO
> 8601, but if one wanted to write some code, they could store it that way as
> a text datatype

That would be an extreme reaction IMO: strong data typing is a good
thing, formatting should be performed external to the database and the
format/unformat operations aren't too involved e.g.

Format$(Now, "yyyy-mm-ddThh:nn:ss")

CDate(Replace$("2007-02-28T08:05:42", "T", " "))

Jamie.

--
Van T. Dinh - 26 Feb 2007 21:43 GMT
How do you want to display the value returned by Now()?

Did you mean the JET AutoNumber Field?

Check the Field Data Type and Size and the Property "New Values" of the
Field in the Table Design view.  They should be:

Data Type: AutoNumber
Field Size: Long Integer
New Values: Increment

Signature

HTH
Van T. Dinh
MVP (Access)

> to get a unique identifier i use the now() function and on the form it
> displays like this "2007-02-26T11:46:57" but uses a 24 hour clock
[quoted text clipped - 5 lines]
>
> thanks,
 
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.