date format into a string

  • Thread starter Thread starter Bernie Yaeger
  • Start date Start date
B

Bernie Yaeger

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
 
Bernie Yaeger said:
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")
 
* "Bernie Yaeger said:
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>)'.
 
Back
Top