-
date format
Hi all
i have a query like this
SELECT i.id, i.startdate, i.duration, i.id_location
FROM instance i, location l
WHERE #course_id# = l.id_course
AND i.id_location = l.id
i get the i.startdate which is a date in a timestampformat.
how do you format it?
-
If it is SQL Server, you can use CONVERT function with STYLE parameter to format date.
CONVERT(varchar(30),startdate,101)
For Oracle you have to use TO_CHAR function with format parameter
TO_CHAR(startdate,'MMD:YYYY')
-
Thx for the reply skhanal
It is SQL Server
but it says i have wrong syntax near convert....
Is it because i run version 4.0.15
-
i use it like this
SELECT i.id, CONVERT(varchar30),startdate,101)
, i.duration, i.id_location
FROM instance i, location l
WHERE #course_id# = l.id_course
AND i.id_location = l.id
is that correct?
-
SELECT i.id, CONVERT(varchar(30),i.startdate,101)
, i.duration, i.id_location
FROM instance i, location l
WHERE #course_id# = l.id_course
AND i.id_location = l.id
You can try other format styles too besides 101. See books online for other options.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|