Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Date Conversions

Posted on 2009-07-06
3
Medium Priority
?
136 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 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 750 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 750 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

885 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