By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,479 Members | 988 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,479 IT Pros & Developers. It's quick & easy.

datepart to get mmddyy from date/time formatted mm/dd/yyyy problems

P: n/a
i have a date (in date/time format with input mask) in access 2002.

field date: 01/01/1970
what i want: 010170 (i.e. mmddyy)

i used:
DatePart("m",[DOB]) + DatePart("d",[DOB]) +
right(DatePart("yyyy",[DOB]), 2)

and i get: 1170

how do i get the leading zero in there so that i can have a six digit
date formatted as mmddyy?

note that if i have a date of: 11/24/1970
i get: 112470 (which works)

thanks!
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Pat
David,
Format() is what you're looking for; not DatePart.

Pound this into the immediate window:

? format(#01/01/1970#,"mmddyy")

HTH
Pat

"david liu" <dy***@pacbell.net> wrote in message
news:6d*************************@posting.google.co m...
i have a date (in date/time format with input mask) in access 2002.

field date: 01/01/1970
what i want: 010170 (i.e. mmddyy)

i used:
DatePart("m",[DOB]) + DatePart("d",[DOB]) +
right(DatePart("yyyy",[DOB]), 2)

and i get: 1170

how do i get the leading zero in there so that i can have a six digit
date formatted as mmddyy?

note that if i have a date of: 11/24/1970
i get: 112470 (which works)

thanks!

Nov 12 '05 #2

P: n/a
this only formats "01/01/1970". how then does it format the actual [DOB] field?

"Pat" <no*****@ihatespam.bum> wrote in message news:<7_*****************@fe2.texas.rr.com>...
David,
Format() is what you're looking for; not DatePart.

Pound this into the immediate window:

? format(#01/01/1970#,"mmddyy")

HTH
Pat

"david liu" <dy***@pacbell.net> wrote in message
news:6d*************************@posting.google.co m...
i have a date (in date/time format with input mask) in access 2002.

field date: 01/01/1970
what i want: 010170 (i.e. mmddyy)

i used:
DatePart("m",[DOB]) + DatePart("d",[DOB]) +
right(DatePart("yyyy",[DOB]), 2)

and i get: 1170

how do i get the leading zero in there so that i can have a six digit
date formatted as mmddyy?

note that if i have a date of: 11/24/1970
i get: 112470 (which works)

thanks!

Nov 12 '05 #3

P: n/a
sorry folks - never mind.

fyi-
format([DOB],"mmddyy")
does the trick.

"Pat" <no*****@ihatespam.bum> wrote in message news:<7_*****************@fe2.texas.rr.com>...
David,
Format() is what you're looking for; not DatePart.

Pound this into the immediate window:

? format(#01/01/1970#,"mmddyy")

HTH
Pat

"david liu" <dy***@pacbell.net> wrote in message
news:6d*************************@posting.google.co m...
i have a date (in date/time format with input mask) in access 2002.

field date: 01/01/1970
what i want: 010170 (i.e. mmddyy)

i used:
DatePart("m",[DOB]) + DatePart("d",[DOB]) +
right(DatePart("yyyy",[DOB]), 2)

and i get: 1170

how do i get the leading zero in there so that i can have a six digit
date formatted as mmddyy?

note that if i have a date of: 11/24/1970
i get: 112470 (which works)

thanks!

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.