Solved

Date Conversions

Posted on 2009-07-06
3
129 Views
Last Modified: 2012-05-07
I need to return 'm/d/yyyy' for 'Business Date' and 'm/d/yyy 6:30 pm' for 'Time Submitted.  How do I change the values?

SELECT
            managerlog.Check_file_date as 'Business Date',
            managerlog.TimeSubmitted as 'Time Submitted',
            vUser_Info.First_Name as 'First Name',
            vUser_Info.Last_Name as 'Last Name',
            managerlog.Notes as 'Notes'
 
 FROM   ManagerLog ManagerLog INNER JOIN vUser_Info vUser_Info ON ManagerLog.UserID=vUser_Info.UserID

Thanks!

-Matt
0
Comment
Question by:mattkovo
3 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 24789945
check out the convert() function
            CONVERT(varchar(10), managerlog.Check_file_date, 101) as 'Business Date',
            CONVERT(varchar(20), managerlog.TimeSubmitted as, 101) 'Time Submitted',

Open in new window

0
 
LVL 17

Assisted Solution

by:pssandhu
pssandhu earned 250 total points
ID: 24790015
Yes, the CONVERT(varchar(10), managerlog.Check_file_date, 101) will you give the right format, however for hh:mm(AM/PM) angels second suggestion won't work. Try something like this:
Convert(varchar(10), managerlog.TimeSubmitted , 101)+' '+Right(Convert(varchar(30), managerlog.TimeSubmitted , 0),7)
P.
0
 

Author Closing Comment

by:mattkovo
ID: 31600394
Thanks guys.  I used a line from each!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access 2010 Query Syntax 5 30
Access 2016 - query 23 60
Email Notifications for SQL 2005 9 28
SQL Server - Set Field Values ito Zero Based on Related Table 4 24
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

770 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