Date format

G

Guest

Hi

I have two dates

Date1 : 12/5/2003
Date2: 12/31/2005

I want to compose a 3rd date: where
Day and month of Date3 are the day and month of date1
and year of date3 is year of date2

so: date3 : 12/5/2005

How can I specify that 12 is a month not a day and 5 is a day not a month

how it's possible to do that?


Thanks
 
G

Guest

Hi Allen
When I put:

Debug.Print DateSerial(Day(#12/5/2003#), Month(#12/5/2003#),
year(#12/31/2005#))

The result is: 28/05/2011
the result should be: 12/05/2005


Any idea

Thanks
Allen Browne said:
Date3 would be:
DateSerial(Year([Date2]), Month([Date3]), Day([Date3])

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hermione said:
I have two dates

Date1 : 12/5/2003
Date2: 12/31/2005

I want to compose a 3rd date: where
Day and month of Date3 are the day and month of date1
and year of date3 is year of date2

so: date3 : 12/5/2005

How can I specify that 12 is a month not a day and 5 is a day not a month

how it's possible to do that?


Thanks
 
G

Guest

Hi allen

I 'm so sorry I realise that DateSerial should take (YEAr, MONTH, DAY) not
as I use

Thank you very much

it work

Hermione said:
Hi Allen
When I put:

Debug.Print DateSerial(Day(#12/5/2003#), Month(#12/5/2003#),
year(#12/31/2005#))

The result is: 28/05/2011
the result should be: 12/05/2005


Any idea

Thanks
Allen Browne said:
Date3 would be:
DateSerial(Year([Date2]), Month([Date3]), Day([Date3])

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hermione said:
I have two dates

Date1 : 12/5/2003
Date2: 12/31/2005

I want to compose a 3rd date: where
Day and month of Date3 are the day and month of date1
and year of date3 is year of date2

so: date3 : 12/5/2005

How can I specify that 12 is a month not a day and 5 is a day not a month

how it's possible to do that?


Thanks
 
A

Allen Browne

DateSerial() requires the year first.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hermione said:
Hi Allen
When I put:

Debug.Print DateSerial(Day(#12/5/2003#), Month(#12/5/2003#),
year(#12/31/2005#))

The result is: 28/05/2011
the result should be: 12/05/2005


Any idea

Thanks
Allen Browne said:
Date3 would be:
DateSerial(Year([Date2]), Month([Date3]), Day([Date3])


Hermione said:
I have two dates

Date1 : 12/5/2003
Date2: 12/31/2005

I want to compose a 3rd date: where
Day and month of Date3 are the day and month of date1
and year of date3 is year of date2

so: date3 : 12/5/2005

How can I specify that 12 is a month not a day and 5 is a day not a
month

how it's possible to do that?


Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top