Display Date as mm/dd/yy (1 Viewer)

Djblois

Registered User.
Local time
Today, 15:43
Joined
Jan 26, 2009
Messages
598
I have tried to be able to have all my dates display with two digit month/ two digit day/ two digit year. I tried the input mask and that doesn't seem to do what I want. Is there a way to get all dates to display like that?
 

Brianwarnock

Retired
Local time
Today, 23:43
Joined
Jun 2, 2003
Messages
12,701
Are you permitted to change your regional settings in Windows?

Brian
 

Djblois

Registered User.
Local time
Today, 15:43
Joined
Jan 26, 2009
Messages
598
I will have to talk to the Head of IT.
 

Rabbie

Super Moderator
Local time
Today, 23:43
Joined
Jul 10, 2007
Messages
5,906
When you display the date use a format command

Format(Mydate,"dd/mm/yy")
 

ChrisO

Registered User.
Local time
Tomorrow, 08:43
Joined
Apr 30, 2003
Messages
3,202
I would not use: -

Format(Mydate,"dd/mm/yy")

because the requirement is for Month/Day/Year and not Day/Month/Year.

Also, since we do not know the Regional Settings that the OP is using, and therefore do not know the date separator in use, then the forward slash should be forced to be a literal by preceding it with a backslash.

Therefore it should become: -

Format(Mydate,"mm\/dd\/yy")
 

missinglinq

AWF VIP
Local time
Today, 18:43
Joined
Jun 20, 2003
Messages
6,423
Rabbie obviously had a slip of the fingers and meant

Format(Mydate,"mm/dd/yy")

and you do not, regardless of the default Regional settings/separator, need to use a backward slash in the Format() function. This is used in Input Masks, not formatting, to force a literal display of a character.
 

ChrisO

Registered User.
Local time
Tomorrow, 08:43
Joined
Apr 30, 2003
Messages
3,202
Plenty of time to but still no reply…
 

Rich

Registered User.
Local time
Today, 23:43
Joined
Aug 26, 2008
Messages
2,898
Since the o.p. only wanted to display the date the format function isn't needed at all
 

missinglinq

AWF VIP
Local time
Today, 18:43
Joined
Jun 20, 2003
Messages
6,423
Since the o.p. only wanted to display the date the format function isn't needed at all

And why is that, Rich? The OP wants the date to display as mm/dd/yy and while the OP doesn't give his OS, Windows since XP defaults to a 4 digit year display, not a two digit display, as he wants.
 

WIS

Registered User.
Local time
Tomorrow, 08:43
Joined
Jan 22, 2005
Messages
170
I have tried to be able to have all my dates display with two digit month/ two digit day/ two digit year. I tried the input mask and that doesn't seem to do what I want. Is there a way to get all dates to display like that?

I don't know whether you've sorted out the date display.

Try this - it seems to be an undocumented feature.

Go to the table and put mm/dd/yy in the Format ppties for the date fld. Go to any form that uses that date and also put mm/dd/yy in the Format ppties.
 

Endojoe

Registered User.
Local time
Today, 17:43
Joined
Apr 7, 2009
Messages
20
WIS, That actually worked wonderfully for me in the situation I'm trying to resolve. However....I'm using a somewhat odd date format, mmm/dd/yyyy, and for consistency's sake, I'm trying to get the month in all caps.

(I'm working with an old table that has a date field that was never configured as an actual date field due to the somewhat odd format required of the date)

So, I'm trying to force this:

Apr/14/2009

to be this:

APR/14/2009

But still allow the field format to be a date. I tried using a > in the Format but that made it no longer a date field. Anybody have any ideas?

Thanks
 

boblarson

Smeghead
Local time
Today, 15:43
Joined
Jan 12, 2001
Messages
32,059
WIS, That actually worked wonderfully for me in the situation I'm trying to resolve. However....I'm using a somewhat odd date format, mmm/dd/yyyy, and for consistency's sake, I'm trying to get the month in all caps.

(I'm working with an old table that has a date field that was never configured as an actual date field due to the somewhat odd format required of the date)

So, I'm trying to force this:

Apr/14/2009

to be this:

APR/14/2009

But still allow the field format to be a date. I tried using a > in the Format but that made it no longer a date field. Anybody have any ideas?

Thanks

APR/14/2009 is not a valid date format, so as hard as you try to make it one, it won't be.
 

Endojoe

Registered User.
Local time
Today, 17:43
Joined
Apr 7, 2009
Messages
20
Well...In Access 2007 anyways, I went into Table Design, selected Date/Time as Field type, then manually keyed in mmm/dd/yyyy for the field format, and did the same in the control on the form I needed it in. This is unique to this particular table and form within the database, the table/form are mutually exclusive and the data is used only for a couple reports that require this date format. It seems to still regard it as a date, and will convert dates entered in other formats to the mmm/dd/yyyy format I specified...so in that respect, at least, it seems to work fine, although I haven't tried linking the table to any other forms or tables, so I'm unsure if it would play well with others that way.
 

WIS

Registered User.
Local time
Tomorrow, 08:43
Joined
Jan 22, 2005
Messages
170
APR/14/2009 is not a valid date format, so as hard as you try to make it one, it won't be.

Bob

I put mmm/dd/yyyy in the Format ppty of the table and it showed Apr/14/2009. I couldn't get to to show APR, only Apr.

WIS
 

WIS

Registered User.
Local time
Tomorrow, 08:43
Joined
Jan 22, 2005
Messages
170
Well...In Access 2007 anyways, I went into Table Design, selected Date/Time as Field type, then manually keyed in mmm/dd/yyyy for the field format, and did the same in the control on the form I needed it in. This is unique to this particular table and form within the database, the table/form are mutually exclusive and the data is used only for a couple reports that require this date format. It seems to still regard it as a date, and will convert dates entered in other formats to the mmm/dd/yyyy format I specified...so in that respect, at least, it seems to work fine, although I haven't tried linking the table to any other forms or tables, so I'm unsure if it would play well with others that way.

I put mmm/dd/yyyy in the Format ppty of the table and it showed Apr/14/2009.

I set up a tbl with DateStart as the only fld, put in a couple of entries and ran the following qry.

SELECT tblDates.DateStart, #6/1/2009#-[tbldates].[datestart] AS DD
FROM tblDates;

It definitely worked with the date format as mmm/dd/yyyy.

As I understand it, Access stores dates as a number, ie the no of days from 12/31/1899, this being day zero. (I might be a day out). So the formatting should be irrelevant as the date is always a number.
 

ChrisO

Registered User.
Local time
Tomorrow, 08:43
Joined
Apr 30, 2003
Messages
3,202
Code:
APR/14/2009 is not a date but "APR/14/2009" is

MsgBox CDate("APR/14/2009")       [color=green]' 14/4/2009 in Day/Month/Year format[/color]
MsgBox IsDate("APR/14/2009")      [color=green]' True[/color]
MsgBox CDbl(CDate("APR/14/2009")) [color=green]' 39917[/color]
    
Why format a date in a table? Tables are for storing data not formats.
Format the date data as where and when needed.
Your users should not be viewing table data anyway.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 23:43
Joined
Sep 12, 2006
Messages
15,656
did mmm/dd/yy work.

if so, can't you capitalise the month by simply saying

ucase(format(anydate,"mmm/dd/yy")

it worked for me APR/15/09
 

Users who are viewing this thread

Top Bottom