jazjef
asked on
How do I use the CONVERT function to display a date as mm/dd/yyyy to the user when using datetime format? How do I 'trim' the time off?
I have a field CHARGEDATE that is a datetime format field that displays yyyy-mm-dd hh:mm:ss.xxxx
How do I display this CHARGEDATE field to users as mm/dd/yyyy (?)
I need to incorporate the CONVERT function into an SQL statement that selects records and returns a result....
For example, this statement selects records:
SELECT [ID], [BILLNUMBER], [CHARGEDATE], [LNAME], [FNAME] FROM [TABLETracking] WHERE (([CHARGEDATE] IS NOT NULL) AND ([CHARGEDATE] >= @CHARGEDATE) AND ([CHARGEDATE] <= @CHARGEDATE2) AND ([7CAT] = @7CAT))
This statement converts to yyyy-mm-dd:
SELECT CONVERT(CHAR(10), CHARGEDATE, 120), ...
FROM myTable
How do I:
1. Incorporate this convert statement into the select statement above so I can run them all at once?
2. Get the converted date format to show as mm/dd/yyyy ?
thanks.....
How do I display this CHARGEDATE field to users as mm/dd/yyyy (?)
I need to incorporate the CONVERT function into an SQL statement that selects records and returns a result....
For example, this statement selects records:
SELECT [ID], [BILLNUMBER], [CHARGEDATE], [LNAME], [FNAME] FROM [TABLETracking] WHERE (([CHARGEDATE] IS NOT NULL) AND ([CHARGEDATE] >= @CHARGEDATE) AND ([CHARGEDATE] <= @CHARGEDATE2) AND ([7CAT] = @7CAT))
This statement converts to yyyy-mm-dd:
SELECT CONVERT(CHAR(10), CHARGEDATE, 120), ...
FROM myTable
How do I:
1. Incorporate this convert statement into the select statement above so I can run them all at once?
2. Get the converted date format to show as mm/dd/yyyy ?
thanks.....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
use it select convert(varchar,getdate(), 101)
ASKER
thanks mastoo!......
solution works great....
JJ
solution works great....
JJ