Solved

datetime convert not seconds

Posted on 2012-04-12
2
219 Views
Last Modified: 2012-06-21
How do I convert datetime to 12.4. 21:50?
I.e. not year and not seconds.
0
Comment
Question by:johnkainn
2 Comments
 
LVL 37

Expert Comment

by:momi_sabag
ID: 37840558
there is no built in way of doing it
you can try

select datepart(day, date_column) + '.' + datepart(month, date_column) + '. ' + datepart(hour, date_column) + ':' + datepart(minute, date_column)
0
 
LVL 24

Accepted Solution

by:
DBAduck - Ben Miller earned 500 total points
ID: 37841153
You could look at the CONVERT statement and use something like in here:
http://technet.microsoft.com/en-us/library/ms174450.aspx

If you convert the date to just a date and then take a LEFT(@string, 5) you could get the date and then do the same for the time.  
The above post would work as well.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Server 2012 r2 - Varible Table 3 43
Add a step to a system backup job 6 37
Applying Roles in Common Scenarios 3 22
SQL profiler 3 21
I have written a PowerShell script to "walk" the security structure of each SQL instance to find:         Each Login (Windows or SQL)             * Its Server Roles             * Every database to which the login is mapped             * The associated "Database User" for this …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

697 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