Solved

how to retrieve in date time as dd-mm-yyyy hh:mm:ss:ss

Posted on 2007-11-20
6
750 Views
Last Modified: 2012-05-05
Hi experts,

how do i achieve the above

thanks
0
Comment
Question by:SirReadAlot
  • 3
  • 2
6 Comments
 
LVL 2

Accepted Solution

by:
talspaugh27 earned 250 total points
ID: 20321115
select convert(varchar(30), getdate(), 105) + ' ' + convert(varchar(30), getdate(), 108)
change the getdate to your date parameter
0
 
LVL 6

Assisted Solution

by:wshark83
wshark83 earned 250 total points
ID: 20321117
select getdate(), convert(varchar(12), getdate(), 107), convert(varchar(10), getdate(), 108)

Results

getdate()
2007-11-20 16:51:11.460      

convert(varchar(12), getdate(), 103)
20/11/2007

convert(varchar(10), getdate(), 108)
16:51:11
0
 
LVL 2

Expert Comment

by:talspaugh27
ID: 20321161
lol both comments came in at the exact same time, looks like EE needs to break it down to the second level on the timestamps
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Author Comment

by:SirReadAlot
ID: 20321180
sorry

i forgot like this

dd-mm-yyyy hh:mm:ss:sss

sorry
0
 

Author Comment

by:SirReadAlot
ID: 20321223
ignore above post pls
0
 
LVL 2

Expert Comment

by:talspaugh27
ID: 20321930
if you are wanting the milliseconds also would be
select (convert(varchar(30), getdate(), 105) + ' ' + convert(varchar(30), getdate(), 114))
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now