Re: Different results if you have String or a Varient for Dates?
From: Vilmar Brazão de Oliveira (teste_at_teste.teste.teste)
Date: 02/16/04
- Next message: Vilmar Brazão de Oliveira: "Re: response.redirect "bla.php""
- Previous message: Vilmar Brazão de Oliveira: "Re: Newbie question about menu bar"
- In reply to: Thomas Scheiderich: "Different results if you have String or a Varient for Dates?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 16 Feb 2004 09:47:39 -0300
hi, try to use formatdatetime function, the help follows:
FormatDateTime Function Language Reference
Version 2
See Also
Description
Returns an expression formatted as a date or time.
Syntax
FormatDateTime(Date[, NamedFormat])
The FormatDateTime function syntax has these parts:
PartDescription
DateRequired. Date expression to be formatted.
NamedFormatOptional. Numeric value that indicates the date/time format used.
If omitted, vbGeneralDate is used.
Settings
The NamedFormat argument has the following settings:
ConstantValueDescription
vbGeneralDate0Display a date and/or time. If there is a date part, display
it as a short date. If there is a time part, display it as a long time. If
present, both parts are displayed.
vbLongDate1Display a date using the long date format specified in your
computer's regional settings.
vbShortDate2Display a date using the short date format specified in your
computer's regional settings.
vbLongTime3Display a time using the time format specified in your computer's
regional settings.
vbShortTime4Display a time using the 24-hour format (hh:mm).
Remarks
The following example uses the FormatDateTime function to format the
expression as a long date and assign it to MyDateTime:
Function GetCurrentDate
' FormatDateTime formats Date in long date.
GetCurrentDate = FormatDateTime(Date, 1)
End Function
bye,
-- ««««««««»»»»»»»»»»»»»» Vlmar Brazão de Oliveira Desenvolvimento Web HI-TEC "Thomas Scheiderich" <tfs@deltanet.com> escreveu na mensagem news:402F04C2.9010205@deltanet.com... > I have the following page as test.aspx: > *************************************************** > <html> > <head> > <title>Hello and Welcome Page</title> > </head> > <body> > <center> > <% > Dim CurrentDate As String > CurrentDate = Today > %> > The current date is <%=CurrentDate %>.<br> > </center> > </body> > </html> > *************************************************** > > If I have CurrentDate as String, like I do here, I get the following > page displayed: > > The current date is 2/14/2004. > > But if I take out the As String and have only "Dim CurrentDate", I get > the following result: > > The current date is 2/14/2004 12:00:00 AM. > > Why do I get the time for the Variant and not for the string? > > Tom. >
- Next message: Vilmar Brazão de Oliveira: "Re: response.redirect "bla.php""
- Previous message: Vilmar Brazão de Oliveira: "Re: Newbie question about menu bar"
- In reply to: Thomas Scheiderich: "Different results if you have String or a Varient for Dates?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|