Aleks
asked on
format time
I have a form that displays time as: 10:00:00
I need to remove the seconds
I am using this value to display the time: <%= (rs_appointment.Fields.Ite m("startim e").Value) %>
This is my SQL:
SELECT a.activityid, a.firmid, a.acttype, a.actname, a.actnote, a.blobid, a.partylist,a.actdesc,a.da teinitiate d, a.processtep, a.lastmodified,a.complete, a.sent_by, a.responsi ble,a.Schd emailon, b.caseid, b.alienid, c.firstnm, c.lastnm, d.mailstr, d.maidenNm, convert(varchar(25), a.dateinitiated, 108) as startime, convert(varchar(25), a.lastmodified, 108) as endtime
FROM dbo.Activities a left join cases as b on a.caseid = b.id left join users as c on b.alienid = c.userid left join users as d on a.responsible = d.userid
WHERE a.ActivityId = MMColParam and a.FirmId = MMColParam2
Help is appreciated.
I need to remove the seconds
I am using this value to display the time: <%= (rs_appointment.Fields.Ite
This is my SQL:
SELECT a.activityid, a.firmid, a.acttype, a.actname, a.actnote, a.blobid, a.partylist,a.actdesc,a.da
FROM dbo.Activities a left join cases as b on a.caseid = b.id left join users as c on b.alienid = c.userid left join users as d on a.responsible = d.userid
WHERE a.ActivityId = MMColParam and a.FirmId = MMColParam2
Help is appreciated.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
to do this in the SQL, just limit the length of the varchar
don't think i agree with this approach, puts unnecessary strain (however small), on the database server, especially when there's a built in function available for use
i had a typo, try:
<%= ( FormatDateTime( rs_appointment.Fields.Item
strain? yikes, the server would have to be less than a Samsung S3 to be affected by that.
I'm simply offering an alternative that will not strain the server. Note, the convert function is already used (and is necessary), all one is adding is a limit to the length of the varchar.
oh, and by the way, if you are using SQL Server 2012 or later you could (should?) achieve this using FORMAT() instead of convert() e.g.
FORMAT([YourTimeColumn],'m m:ss')
I have no problem at all formatting at the presentation layer, but it may suit to use the dbms.
I'm simply offering an alternative that will not strain the server. Note, the convert function is already used (and is necessary), all one is adding is a limit to the length of the varchar.
oh, and by the way, if you are using SQL Server 2012 or later you could (should?) achieve this using FORMAT() instead of convert() e.g.
FORMAT([YourTimeColumn],'m
I have no problem at all formatting at the presentation layer, but it may suit to use the dbms.
ASKER
Thanks to both !
ASKER
Error:
Microsoft VBScript compilation error '800a03ee'
Expected ')'
/BlueDot/Intranet/Calendar
Response.Write(( FormatDateTime( rs_appointment.Fields.Item
--------------------------