Im trying to convert a datetime value to a varchar
Ive used cast( datetimevalue as varchar(10)) but am not geting the desired
result. Im looking for a DD/MM/YYYY resultUse function CONVERT instead.
Example:
select convert(char(10), getdate(), 103)
AMB
"Peter Newman" wrote:
> Im trying to convert a datetime value to a varchar
> Ive used cast( datetimevalue as varchar(10)) but am not geting the desire
d
> result. Im looking for a DD/MM/YYYY result|||try this one
Select
Convert(Varchar(12),GetDate(),101),
Convert(VarChar(12),GetDate(),102),
Convert(VarChar(12),GetDate(),103),
Convert(VarChar(12),GetDate(),104),
Convert(VarChar(12),GetDate(),105),
Convert(VarChar(12),GetDate(),106),
Convert(VarChar(12),GetDate(),107),
Convert(Varchar(11),GetDate(),108),
Convert(VarChar(12),GetDate(),109),
Convert(VarChar(12),GetDate(),110),
Convert(VarChar(12),GetDate(),111),
Convert(VarChar(12),GetDate(),112),
Convert(VarChar(12),GetDate(),113),
Convert(VarChar(12),GetDate(),114)
nivek
"Peter Newman" <PeterNewman@.discussions.microsoft.com> wrote in message
news:3F16F075-1C14-4CCD-A91D-13231E67A071@.microsoft.com...
> Im trying to convert a datetime value to a varchar
> Ive used cast( datetimevalue as varchar(10)) but am not geting the
> desired
> result. Im looking for a DD/MM/YYYY result
Thursday, March 22, 2012
DateTime to Varchar
Labels:
cast,
convert,
database,
datetime,
datetimevalue,
desiredresult,
geting,
microsoft,
mysql,
oracle,
server,
sql,
value,
varchar,
varcharive
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment