Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date part problem

Status
Not open for further replies.

GirlBlonde

Programmer
Oct 30, 2007
94
AU
hi guys

another strange problem i am using the below datepart refernce to obtain only the year from a date field and the date is 31/01/08 and for some reason the code is picking up 1905. can anyone tell me why?

Energy & persistance conquer all things!
 
Can you show your code?

You could also try the Year function.


 
Perhaps it has to do with your format?

If I enter 31/01/08 into a date field, it changes to 1/8/1931. If I enter 01/31/08, Access accepts it.

Regional settings?

Randy
 
it is probably doing 31 divided by 1 divided by 8, and taking the value and converting it to a date.

Check that your international format and any date formats are not set to US format.

SeeThru
Synergy Connections Ltd - Telemarketing Services
 
hi

my code is =DatePart("yyyy",[date])

i can not get into my computers control pannel for date details. is there another way to check what setting it is on?

Energy & persistance conquer all things!
 
What happens if you use the Year function? i.e.

=Year([date])

By the way, using Date as field name is not a good idea, as that is a reserved word in Access.

 
hi it just comes up 1905

Energy & persistance conquer all things!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top