I am trying to use DatePart to return a two digit month. I would like to see 01, 02, 03, ...10, 11, 12 for the months. How can I do this? I'm sure it has something to do with the format of my date field, but I can't figure out the custom format for it.
Thank you,
ang
11 33055
You can't with DatePart, but you can with format(YourDate,"mm")
format(now,"mm") for instance will return 01
I am trying to use DatePart to return a two digit month. I would like to see 01, 02, 03, ...10, 11, 12 for the months. How can I do this? I'm sure it has something to do with the format of my date field, but I can't figure out the custom format for it.
Thank you,
ang
Format$(DatePart("m", #1/6/2006#), "00") ==> 01
I'm curious, why would you want to use 2 functions to do the job that one function can do?
I'm curious, why would you want to use 2 functions to do the job that one function can do?
You would never, but apartain specifically stated that he wished to use the DatePart Function.
That's kinda what I figured, but I don't really think he's married to the idea, I think he just thought that DatePart was the only way to pull the month from the date. Of course, you have to wonder why MS won't let you use the "mm" with DatePart the same way as with Format to pull the two digit month designation.
Have a good weekend!
I'm curious, why would you want to use 2 functions to do the job that one function can do?
Linq,
Hope you don't mind me sending this question to you direct, but based on above, it seems that you have the answer to my question...
I'm grouping dates by month in a query for purpose of counts and averages on some other fields. Results display month as single digit (i.e. Jan = 1, Feb = 2, etc.). I would like to format the field so I get the month name spelled out, or better yet month-year (i.e. Jan-06, Feb-06, etc.). The auto format in Properties only provides number formats.
Here's what I have for a query field so far: SALE MONTH: DatePart("m",[SALE-DATE])
I tried this with no luck:
DatePart("mmmm",[SALE-DATE])
Thanx in advance.
Try this ...
Format(YourDate,"mmm-yy")
Try this ...
Format(YourDate,"mmm-yy")
Thanx Masq... worked great.
Thanx Masq... worked great.
You're welcome.
NeoPa 32,556
Expert Mod 16PB
Actually, in VBA, minutes are handled by n and months by m (of either case). The link you posted was for C# in .NET.
I couldn't find anywhere helpful on the web (unfortunately), but the Help System has a page that makes it pretty clear.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Lauren Quantrell |
last post by:
I have a stored procedure using Convert where the exact same Convert
string works in the SELECT portion of the procedure but fails in the
WHERE portion.
The entire SP is listed below....
|
by: Job Lot |
last post by:
I have two ComboBox on a form both holding list of months in a year (Jan –
Dec).
I wan to calculate number of months between Month selected in first combobox
and Month selected in second...
|
by: Ataru Morooka |
last post by:
Hi, my table has to have a column with the months names (january,
february...).
When I order it by month it is ordered alphabetically and that's not
what I need.
Reading this ng I found someone...
|
by: John |
last post by:
Hi,
I am using a text box to input a date in a form and from that date I
want to show a new date in another text box which is one calendar week
later. As it is, it works fine untill I reach the...
|
by: J-P-W |
last post by:
Hi,
I have a system that records insurance policies.
If the policy is cancelled then any part of a month insured is deducted
from the premium, so a policy that ran for 32 days would get a 10...
|
by: apartain |
last post by:
I use DatePart("ww",.Date) to get the number of the week in the year for a weekly time card.
The week in the system is beginning Sunday and ending Saturday. Is there any way to make it beginning...
|
by: Seb |
last post by:
I want to count activity in a given month. I'm trying to do so with
the linq code below however it reports:
Error 1 'a' is inaccessible due to its protection level
var ActivityByMonths = from a...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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,...
|
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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,...
| |