473,386 Members | 1,606 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,386 software developers and data experts.

Left, Right Mid?

I have been trying to extract the digits between the two / symbols in a
date. For example the date (in Australian format, not US) is 23/12/2004. I
want to be able to extract the 12 (Month) from that. I have tried various
left, right and mid functions, but I only seem to be able to get the 23, the
04 or the full date. What is the correct function to use?

dixie
Nov 13 '05 #1
9 6232
"dixie" <di***@dogmail.com> wrote in message
news:41********@duster.adelaide.on.net...
I have been trying to extract the digits between the two / symbols in a
date. For example the date (in Australian format, not US) is 23/12/2004. I want to be able to extract the 12 (Month) from that. I have tried various
left, right and mid functions, but I only seem to be able to get the 23, the 04 or the full date. What is the correct function to use?

dixie


Dixie, if the date is stored as a Date field, you can use the DatePart
function to extract the month.

Dim d As Date
d = "12/22/2004" ' Americanized form
Debug.Print DatePart("m", d)

prints:
12

HTH,
Randy
Nov 13 '05 #2
On Thu, 23 Dec 2004 07:12:20 +1100, dixie wrote:
I have been trying to extract the digits between the two / symbols in a
date. For example the date (in Australian format, not US) is 23/12/2004. I
want to be able to extract the 12 (Month) from that. I have tried various
left, right and mid functions, but I only seem to be able to get the 23, the
04 or the full date. What is the correct function to use?

dixie


If the field is a valid date datatype (not text datatype):
=Month([DateField])
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #3
?month(#23/12/2004#)
12

?day(#23/12/2004#)
23

?year(#23/12/2004#)
2004

You must put the Hash# sign on anything to do with dates
Phil
"dixie" <di***@dogmail.com> wrote in message
news:41********@duster.adelaide.on.net...
I have been trying to extract the digits between the two / symbols in a
date. For example the date (in Australian format, not US) is 23/12/2004.
I want to be able to extract the 12 (Month) from that. I have tried
various left, right and mid functions, but I only seem to be able to get
the 23, the 04 or the full date. What is the correct function to use?

dixie

Nov 13 '05 #4
Of course, ?month(#11/12/2004#) is going to return 11, regardless of what
the short date format is set to!

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Phil Stanton" <di********@stantonfamily.co.uk> wrote in message
news:41*********************@mercury.nildram.net.. .
?month(#23/12/2004#)
12

?day(#23/12/2004#)
23

?year(#23/12/2004#)
2004

You must put the Hash# sign on anything to do with dates
Phil
"dixie" <di***@dogmail.com> wrote in message
news:41********@duster.adelaide.on.net...
I have been trying to extract the digits between the two / symbols in a
date. For example the date (in Australian format, not US) is 23/12/2004.
I want to be able to extract the 12 (Month) from that. I have tried
various left, right and mid functions, but I only seem to be able to get
the 23, the 04 or the full date. What is the correct function to use?

dixie


Nov 13 '05 #5
It is. Is there an way I can make it return 01, 02, etc for the months
previous to October?

"fredg" <fg******@example.invalid> wrote in message
news:dl*****************************@40tude.net...
On Thu, 23 Dec 2004 07:12:20 +1100, dixie wrote:
I have been trying to extract the digits between the two / symbols in a
date. For example the date (in Australian format, not US) is 23/12/2004.
I
want to be able to extract the 12 (Month) from that. I have tried
various
left, right and mid functions, but I only seem to be able to get the 23,
the
04 or the full date. What is the correct function to use?

dixie


If the field is a valid date datatype (not text datatype):
=Month([DateField])
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Nov 13 '05 #6
I meant there that it returns a 1 digit number and I would like a 2 digit
number.

dixie

"dixie" <di***@dogmail.com> wrote in message
news:41******@duster.adelaide.on.net...
It is. Is there an way I can make it return 01, 02, etc for the months
previous to October?

"fredg" <fg******@example.invalid> wrote in message
news:dl*****************************@40tude.net...
On Thu, 23 Dec 2004 07:12:20 +1100, dixie wrote:
I have been trying to extract the digits between the two / symbols in a
date. For example the date (in Australian format, not US) is
23/12/2004. I
want to be able to extract the 12 (Month) from that. I have tried
various
left, right and mid functions, but I only seem to be able to get the 23,
the
04 or the full date. What is the correct function to use?

dixie


If the field is a valid date datatype (not text datatype):
=Month([DateField])
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.


Nov 13 '05 #7
On Thu, 23 Dec 2004 09:02:16 +1100, dixie wrote:
I meant there that it returns a 1 digit number and I would like a 2 digit
number.

dixie

"dixie" <di***@dogmail.com> wrote in message
news:41******@duster.adelaide.on.net...
It is. Is there an way I can make it return 01, 02, etc for the months
previous to October?

"fredg" <fg******@example.invalid> wrote in message
news:dl*****************************@40tude.net...
On Thu, 23 Dec 2004 07:12:20 +1100, dixie wrote:

I have been trying to extract the digits between the two / symbols in a
date. For example the date (in Australian format, not US) is
23/12/2004. I
want to be able to extract the 12 (Month) from that. I have tried
various
left, right and mid functions, but I only seem to be able to get the 23,
the
04 or the full date. What is the correct function to use?

dixie

If the field is a valid date datatype (not text datatype):
=Month([DateField])
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.



=Format(Month([DateField]),"00")
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #8
That fixed it. Tah.

dixie

"fredg" <fg******@example.invalid> wrote in message
news:1x*******************************@40tude.net. ..
On Thu, 23 Dec 2004 09:02:16 +1100, dixie wrote:
I meant there that it returns a 1 digit number and I would like a 2 digit
number.

dixie

"dixie" <di***@dogmail.com> wrote in message
news:41******@duster.adelaide.on.net...
It is. Is there an way I can make it return 01, 02, etc for the months
previous to October?

"fredg" <fg******@example.invalid> wrote in message
news:dl*****************************@40tude.net...
On Thu, 23 Dec 2004 07:12:20 +1100, dixie wrote:

> I have been trying to extract the digits between the two / symbols in
> a
> date. For example the date (in Australian format, not US) is
> 23/12/2004. I
> want to be able to extract the 12 (Month) from that. I have tried
> various
> left, right and mid functions, but I only seem to be able to get the
> 23,
> the
> 04 or the full date. What is the correct function to use?
>
> dixie

If the field is a valid date datatype (not text datatype):
=Month([DateField])
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.


=Format(Month([DateField]),"00")
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Nov 13 '05 #9
On Thu, 23 Dec 2004 09:02:16 +1100, dixie wrote:
I meant there that it returns a 1 digit number and I would like a 2 digit
number.

right("00" & month([datefield]) , 2)

Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Alex | last post by:
Hi Everone, I need some advice on how to setup 4 columns where the outside two are absolute (120px) and the inner two (side by side) are relevent (Fluid) and change with the screen. Here's my...
18
by: Jm | last post by:
Hi all I feel stupid for asking this, but i just went to use the left() function from vb6 only to find it doesnt do what it used to under .NET. Im assuming theres something else now im meant to...
0
by: jonipony | last post by:
HELP: Float Left box is drifting to the right in ie! -------------------------- I need som HELP with my CSS coding! On the following web page my design falls apart at screen size 800 x 600...
4
by: Austin Powers | last post by:
I want to (on one line) show something like the following ------------------------------------------------------- left centered right...
19
by: ashkaan57 | last post by:
Hi, I have a page in a right-to-left language and I am trying to make some bulleted lists using <ul>, but it puts the bullets to the left. Is there any way I can set the bullets to be on the...
3
by: Sjef Janssen | last post by:
Is it possible to have a box (div) which sets a background-color and which contains (on the same line) text which is left aligned and text which is right aligned. (as in a table: two td's left one...
5
by: OtisUsenet | last post by:
Hi, I'm killing myself trying to get a "horizontal nav bar" where some text is left aligned, and some is aligned to the right, kind of like this: LEFT ...
2
by: RobinS | last post by:
Is it possible to left-justify, center, or right-justify text on a panel when drawing it using DrawString? I looked at the StringAlignment class, but all it has is far, near, and center. ...
5
by: Timeri | last post by:
This is a bit confusing until you actually see what I'm talking about but the main content of my page is not growing with the right column. I want the main content (left/larger column) to take into...
3
by: Noorain | last post by:
I designed a site. i want to header,footer,left & right column fixed but body information only scrolling. this site screen to be 800/600 px. i designed this way but when i used position fixed all...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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...
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
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,...

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.