By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,377 Members | 1,655 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,377 IT Pros & Developers. It's quick & easy.

date format into a string

P: n/a
I'm trying to get '20030904' into a string where mdate is a date variable.
Using formatdatetime I can't seem to get closer than a shortdate, but that
yields '9/4/03', from which I could surely pull out strings using instr, but
is there a more direct way?

Tx for any help.

Bernie Yaeger
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Bernie Yaeger" <be*****@cherwellinc.com> schrieb
I'm trying to get '20030904' into a string where mdate is a date
variable. Using formatdatetime I can't seem to get closer than a
shortdate, but that yields '9/4/03', from which I could surely pull
out strings using instr, but is there a more direct way?

dim s as string
s = mdate.tostring("yyyyMMdd")
--
Armin

Nov 20 '05 #2

P: n/a
* "Bernie Yaeger" <be*****@cherwellinc.com> scripsit:
I'm trying to get '20030904' into a string where mdate is a date variable.
Using formatdatetime I can't seem to get closer than a shortdate, but that
yields '9/4/03', from which I could surely pull out strings using instr, but
is there a more direct way?


Have a look at 'Date.ToString(<format>)'.

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

P: n/a
Tx Armin, Herfried.

Bernie
"Armin Zingler" <az*******@freenet.de> wrote in message
news:eA*************@TK2MSFTNGP12.phx.gbl...
"Bernie Yaeger" <be*****@cherwellinc.com> schrieb
I'm trying to get '20030904' into a string where mdate is a date
variable. Using formatdatetime I can't seem to get closer than a
shortdate, but that yields '9/4/03', from which I could surely pull
out strings using instr, but is there a more direct way?

dim s as string
s = mdate.tostring("yyyyMMdd")
--
Armin

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.