Date on Access

  • Thread starter Thread starter DumUSER
  • Start date Start date
D

DumUSER

Hi

How do I get Access to only show the year. I tried putting the date format :
yyyy, for some reason it doesn't work.
thannks
any ideas
 
A format of "yyyy" should work. How and where are you trying to apply it,
and what is happening when you do?

An alternative is to use the Year() function. For example, in a query, in
design view, you could use TheYear:Year([YourDateField]). In the control
source of a text box you could use =Year([YourDateField]).

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
That kinda depends on where you are trying to get Access to show it, and
where (and how) you put the "yyyy".
 
I'm doing this on the Field Properties > General > Format > YYYY and it
still does not work.
I only to put year in the following format: 2004
thanks




Brendan Reynolds said:
A format of "yyyy" should work. How and where are you trying to apply it,
and what is happening when you do?

An alternative is to use the Year() function. For example, in a query, in
design view, you could use TheYear:Year([YourDateField]). In the control
source of a text box you could use =Year([YourDateField]).

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


DumUSER said:
Hi

How do I get Access to only show the year. I tried putting the date
format
:
yyyy, for some reason it doesn't work.
thannks
any ideas
 
I'm doing this on the Field Properties > General > Format > YYYY and it
still does not work.
I only to put year in the following format: 2004
thanks
 
DumUSER said:
I'm doing this on the Field Properties > General > Format > YYYY and it
still does not work.
I only to put year in the following format: 2004
thanks

Well, as a test, I opened the Northwind Orders table in design view,
selected the OrderDate field, and set the Format property to yyyy. When I
switch to datasheet view, the year part only is displayed in the OrderDate
column.

What happens when you try it? If you're not seeing just the year part, what
are you seeing? If you enter today's date, for example, what does it look
like in your table?

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
Brendan Reynolds said:
A format of "yyyy" should work. How and where are you trying to apply it,
and what is happening when you do?

An alternative is to use the Year() function. For example, in a query, in
design view, you could use TheYear:Year([YourDateField]). In the control
source of a text box you could use =Year([YourDateField]).

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


DumUSER said:
Hi

How do I get Access to only show the year. I tried putting the date
format
:
yyyy, for some reason it doesn't work.
thannks
any ideas
 
Thanks, it works. Now I can't explain why?

Brendan Reynolds said:
DumUSER said:
I'm doing this on the Field Properties > General > Format > YYYY and it
still does not work.
I only to put year in the following format: 2004
thanks

Well, as a test, I opened the Northwind Orders table in design view,
selected the OrderDate field, and set the Format property to yyyy. When I
switch to datasheet view, the year part only is displayed in the OrderDate
column.

What happens when you try it? If you're not seeing just the year part, what
are you seeing? If you enter today's date, for example, what does it look
like in your table?

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
Brendan Reynolds said:
A format of "yyyy" should work. How and where are you trying to apply it,
and what is happening when you do?

An alternative is to use the Year() function. For example, in a query, in
design view, you could use TheYear:Year([YourDateField]). In the control
source of a text box you could use =Year([YourDateField]).

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


Hi

How do I get Access to only show the year. I tried putting the date format
:
yyyy, for some reason it doesn't work.
thannks
any ideas
 
I'm doing this on the Field Properties > General > Format > YYYY and it
still does not work.
I only to put year in the following format: 2004
thanks

Just note that a Date/Time value is ALWAYS stored as a complete date -
internally, it's a Double Float count of days and fractions of a day
(times) since midnight, December 30, 1899. 2004 *is not an exact point
in time*. What will actually be stored in your table is 37987.00000000
which corresponds to midnight, January 1, 2004.

If you use the YYYY format, than you could have #7/21/2004 14:22:18#
stored in the table and it will display as 2004 - so your searches
might not work!

If all you need is a year, I'd strongly suggest NOT using a date/time
field; use an Integer number instead.
 
Thanks.

John Vinson said:
Just note that a Date/Time value is ALWAYS stored as a complete date -
internally, it's a Double Float count of days and fractions of a day
(times) since midnight, December 30, 1899. 2004 *is not an exact point
in time*. What will actually be stored in your table is 37987.00000000
which corresponds to midnight, January 1, 2004.

If you use the YYYY format, than you could have #7/21/2004 14:22:18#
stored in the table and it will display as 2004 - so your searches
might not work!

If all you need is a year, I'd strongly suggest NOT using a date/time
field; use an Integer number instead.
 
Back
Top