Convert Date to number?

J

JethroUK©

How would i convert a date to number as a string

e.g. 10/05/2005 > "20050510"

note the month is 2 digit - 05

i cant see Format(A1,"yyyy,mm,dd") & i tried = year(a1) & month(a1) &
day(a1)

but it returns month as single "2005510"
 
J

JethroUK©

p.s. i also tried cell formatting as yyyymmdd, then = "Hello" & A1 - but it
doesn't import the format to a string
 
S

Sandy Mann

There may be better ways but:

=TEXT(YEAR(E10),"####")&TEXT(MONTH(E10),"0#")&TEXT(DAY(E10),"0#")

returns what you are looking for
--
HTH

Sandy
In Perth, the ancient capital of Scotland

(e-mail address removed)
(e-mail address removed) with @tiscali.co.uk
 
S

Sandy Mann

Miguel Zapico said:
You can try with TEXT, like this:
=TEXT(A1,"yyyymmdd")

There I told you there may be better ways! <g>
--

Sandy
In Perth, the ancient capital of Scotland

(e-mail address removed)
(e-mail address removed) with @tiscali.co.uk
 
J

JethroUK©

that's fine

so how will i emmbed this in a string e.g.

="Bill" & TEXT(A1,"yyyymmdd") & "Ben"
 

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

Top