Answered by:
How to get current Time in HHmmssSSS format

Question
-
User-1061665085 posted
Hi,
I tried using
SELECT replace(Convert (varchar(8),GetDate(), 108),':','') + SELECT DATEPART(ms,SYSDATETIME());
but it gives only HHmmss part not milli second.
Please help!
Thanks
Aiden
Thursday, November 19, 2015 8:32 AM
Answers
-
User2103319870 posted
mr.ab18
but it gives only HHmmss part not milli second.You just need to use DateFormat 114 instead of 108
SELECT replace(Convert (varchar(15),GetDate(), 114),':','')
Note that I have increased the size of Varchar to 15 so that it will include the microseconds also
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, November 19, 2015 8:54 AM -
-
User77042963 posted
select format(getdate(),'HHmmssfff')
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, November 19, 2015 9:24 AM
All replies
-
User2103319870 posted
mr.ab18
but it gives only HHmmss part not milli second.You just need to use DateFormat 114 instead of 108
SELECT replace(Convert (varchar(15),GetDate(), 114),':','')
Note that I have increased the size of Varchar to 15 so that it will include the microseconds also
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, November 19, 2015 8:54 AM -
User-1061665085 posted
mr.ab18
but it gives only HHmmss part not milli second.You just need to use DateFormat 114 instead of 108
SELECT replace(Convert (varchar(15),GetDate(), 114),':','')
Also this working after lot of try
SELECT convert(varchar,replace(Convert (varchar(8),GetDate(), 108),':','')) + convert(varchar,DATEPART(ms,SYSDATETIME()))
:)
Thursday, November 19, 2015 8:56 AM -
-
User77042963 posted
select format(getdate(),'HHmmssfff')
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, November 19, 2015 9:24 AM -
User-1061665085 posted
select format(getdate(),'HHmmssfff')
Friday, November 20, 2015 2:51 AM