how can I get a date in the following format

dd-mmm-yyyy

ie 01-APR-1999

in visual basic I can use the formatdate function and the formatting
is flexible enough to create this string. In vbscript the
functionality seems more limited. Is there a simple way to do this?

thank you for your help


cheers


john

Re: formating a date string in vbscript by Torgeir

Torgeir
Mon Nov 29 09:02:39 CST 2004

John Coltrane wrote:

> how can I get a date in the following format
>
> dd-mmm-yyyy
>
> ie 01-APR-1999
>
> in visual basic I can use the formatdate function and the formatting
> is flexible enough to create this string. In vbscript the
> functionality seems more limited. Is there a simple way to do this?
Hi

'--------------------8<----------------------
sNow = Now
sMyDate = Right(100 + Day(sNow), 2) & "-" _
& MonthName(Month(sNow), True) & "-" & Year(sNow)

WScript.Echo sMyDate
'--------------------8<----------------------


--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

Re: formating a date string in vbscript by tendengarci

tendengarci
Mon Nov 29 14:52:59 CST 2004

Thank you very much

"Torgeir Bakken \(MVP\)" <Torgeir.Bakken-spam@hydro.com> wrote in message news:<#o5Y$Ri1EHA.2572@tk2msftngp13.phx.gbl>...
> John Coltrane wrote:
>
> > how can I get a date in the following format
> >
> > dd-mmm-yyyy
> >
> > ie 01-APR-1999
> >
> > in visual basic I can use the formatdate function and the formatting
> > is flexible enough to create this string. In vbscript the
> > functionality seems more limited. Is there a simple way to do this?
> Hi
>
> '--------------------8<----------------------
> sNow = Now
> sMyDate = Right(100 + Day(sNow), 2) & "-" _
> & MonthName(Month(sNow), True) & "-" & Year(sNow)
>
> WScript.Echo sMyDate
> '--------------------8<----------------------