473,395 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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
3 12568
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
0
by: Gernot Saborowski | last post by:
To all IIS/ASP-professionals, we just upgraded from one machine to another and are experiencing some strange date time number problems. Both systems have been set up like this: - MS Windows...
5
by: Gord | last post by:
Many scripts and calendars call client side system time in order to make presentations. However, the client's time may be improperly set, if set at all, and/or the relevant time may be from...
10
by: okaminer | last post by:
Hi I have a program which need to get the date in the format of dd/MM/yyyy (example 24/7/2005) but when I use DateTime.Now().ToShortDatetime() the date come back as MM/dd/yyyy (example...
7
by: Jerome | last post by:
Hallo, I know a lot has already been told about date/time fields in a database but still confuses me, specif when dealing with SQLserver(Express). It seems that sqlserver only accepts the date in...
2
by: musosdev | last post by:
Hi guys I'm having a problem with DateTime.Now.ToShortDateString(). It works fine, but I've got 2 servers (development and production), and while the production server works perfectly and...
3
by: Jim in Arizona | last post by:
I have a gridview that's being populated from an access db query. The problem I'm having is that the date/time fields in access that are populating the gridview are showing both date and time, when...
4
by: sbowman | last post by:
I have a table with help desk ticketing information. There is a Date/Time open, Date/Time closed field both formatted as: MM/DD/YYYY hh:nn:ss I need to calculate the difference between these two...
3
by: matturbanowski | last post by:
Hi, I have a date/time field in a SQL2000 database, and what I would like to do is to filter on a specific part of the field, for example the time or hour. Supposing I have a set of data for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.