Format date question

  • Thread starter Mikael Lindqvist
  • Start date
M

Mikael Lindqvist

Hi everyone,

I have a textfield that I want to change (with a query) to "yymm".

Format([Datefield];"yyyymm")

is working, but not

Format([Datefield];"yymm")

Which really puzzles me..

It doesn't matter if the the new field is "date" or "text" as long as it
displays yy (2 digits) and mm (2 digits).

Any ideas?

Kindly
Mikael
Sweden
 
J

John Spencer

What version of Access?
I just tested with 2003 (US) and it returned 0801 for the current date

A workaround might be to use
Right(Format([Datefield];"yyyymm");4)

AHHH! A **TEXT** field. In that case, the format function may be having
trouble converting. Can you convert the text field to a datetime type
first?

I just tested a text string and it did convert correctly for me if the text
was delimited with dashes or slashes. However, with periods it did not
convert as desired.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
J

John W. Vinson

Hi everyone,

I have a textfield that I want to change (with a query) to "yymm".

What's in the textfield now? Without knowing where we're starting, it's a bit
hard to tell you how to go!

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top