我从日历扩展程序存储日期时间并将其存储在数据库中。日期时间格式为Format="dddd, MMMM dd, yyyy"
。然后我显示这个日期时间与网格视图中的其他字段,并将该字段命名为“CalendarDate”。目前网格中的CalendarDate显示为"6/29/2012 10:42:35 AM"
。SQL中的时间格式
我希望日历日期显示日期如下: - “2012年6月29日上午10:42”。只有几秒钟将被删除。请告诉我,我是如何做到这一点。
存储过程现在用它IM是这样的: -
Create procedure St_Proc_GetUserReportforCurrentDayTask
@userID int
as
Begin
set NoCount on;
DECLARE @TODAY DATE
SET @TODAY = CONVERT(VARCHAR(10), GETDATE(), 111)
select Production.CalendarDate as Date,
RegionAndProjectInfo.RegionProjectName as Region ,
County.CountyName as County,
WorkType.WorkTypeName as WorkType,
Task.TaskName as Task,
Production.VolumeProcessed as 'Volumes Processed',
Production.TimeSpent as 'Duration (HH:MM)'
from Production
inner join RegionAndProjectInfo
on
RegionAndProjectInfo.RegionProjectID=Production.RegionProjectID
inner join County
on
County.CountyID=Production.CountyID
inner join WorkType
on
WorkType.WorkTypeID=Production.WorkTypeID
inner join Task
on
Task.TaskID=Production.TaskID
where [email protected] and CalendarDate >= @TODAY
End
日期类型没有格式。只有在您将日期值转换为字符串时才使用特定的格式,反之亦然。 –