Microsoft
Software
Hardware
Network
Question : Sql query returns 24 hour time format instead of 12 hour am/pm format:
The following query returns the datetime fields as a 24 hour format but I desire a 12 hour AM/PM format. Note: The tables referenced in the following query have all datetime fields in the 12 hour format.
DECLARE
@CurrentDate AS nvarchar(20),
@Today AS datetime
SET @CurrentDate = CONVERT(NVARCHAR(20), GETDATE(), 111)
SET @CurrentDate = @CurrentDate + ' 12:00 AM'
SET @Today = CAST(@CurrentDate AS DATETIME)
print '@CurrentDate = ' + @CurrentDate
print '@Today = ' + CAST(@Today AS VARCHAR(20))
SELECT TOP(100) dbo.T_Schedule.SCH_Date, dbo.T_Model.MDL_Number, dbo.T_ScheduleSequence.SCH
SEQ_Proces
sID,
dbo.T_ScheduleSequenceHist
ory.SSH_St
atus, dbo.T_ScheduleSequenceHist
ory.SSH_Cr
eateDate
FROM dbo.T_ScheduleSequenceHist
ory INNER JOIN
dbo.T_ScheduleSequence ON dbo.T_ScheduleSequenceHist
ory.SSH_SC
HSEQID = dbo.T_ScheduleSequence.SCH
SEQ_ID INNER JOIN
dbo.T_Model ON dbo.T_ScheduleSequence.SCH
SEQ_MDLID = dbo.T_Model.MDL_ID INNER JOIN
dbo.T_Schedule ON dbo.T_ScheduleSequence.SCH
SEQ_SCHID = dbo.T_Schedule.SCH_ID
WHERE (dbo.T_Schedule.SCH_LID = 3) AND (dbo.T_ScheduleSequenceHis
tory.SSH_C
reateDate >= @CurrentDate)
ORDER BY dbo.T_ScheduleSequenceHist
ory.SSH_Cr
eateDate
Answer : Sql query returns 24 hour time format instead of 12 hour am/pm format:
My understanding is that mysql stores time in the 24hr format but you can format the form to display in am/pm
Random Solutions
how to truncate the transaction logs in exchange 2010 after NT backup
I need to query each group in an OU in the Root Domain and get the group names that has exact identical users.
How to get an USB speaker to work with Eee PC 900 Xandros Linux
How to increase speed of UltraVNC
Add Mirror Greyed Out
Can't access Exchange 2003 OWA from Internet
Windows 2008 Server Domain isues
Websense - Block Internet Access - Except for Updates
removing xml node from database
How to find out what version of remote OpenSSL server is running?