Showing posts with label excisting. Show all posts
Showing posts with label excisting. Show all posts

Monday, March 19, 2012

Datetime only time needed

Wel maybe someone could help me.
I'm working with an excisting database using MSSQL, where are 2 T_datetime
fields.
If i display these 2 columns i see the date time format as follow:
Aug 5 2004 6:03PM
The problem is that i only need de time format like 6:03PM or better if
possible 18:03.
Could anybody help mee with these 2 problems.See function CONVERT in BOL. It is better to do the formatting in your clien
t
app, reporting tool, or programming language.
select left(right(convert(varchar(25), getdate(), 100), 7), 5)
AMB
"Smarteye" wrote:

> Wel maybe someone could help me.
> I'm working with an excisting database using MSSQL, where are 2 T_datetime
> fields.
> If i display these 2 columns i see the date time format as follow:
> Aug 5 2004 6:03PM
> The problem is that i only need de time format like 6:03PM or better if
> possible 18:03.
> Could anybody help mee with these 2 problems.|||I cannot change the excisting Database,
If i use this code i see no output in Php.
does any know
"Alejandro Mesa" wrote:
> See function CONVERT in BOL. It is better to do the formatting in your cli
ent
> app, reporting tool, or programming language.
>
> select left(right(convert(varchar(25), getdate(), 100), 7), 5)
>
> AMB
>
> "Smarteye" wrote:
>|||> I cannot change the excisting Database,
I did not say to change the db.

> If i use this code i see no output in Php.
> does any know
>
Which code?
AMB
"Smarteye" wrote:
> I cannot change the excisting Database,
> If i use this code i see no output in Php.
> does any know
> "Alejandro Mesa" wrote:
>|||What do you mean, if I display these 2 columns? Can you do a select in QA
and post the results?
----
Louis Davidson - drsql@.hotmail.com
SQL Server MVP
Compass Technology Management - www.compass.net
Pro SQL Server 2000 Database Design -
http://www.apress.com/book/bookDisplay.html?bID=266
Blog - http://spaces.msn.com/members/drsql/
Note: Please reply to the newsgroups only unless you are interested in
consulting services. All other replies may be ignored :)
"Smarteye" <Smarteye@.discussions.microsoft.com> wrote in message
news:4EDDC42C-6CCE-4685-B84E-936C177C2E6A@.microsoft.com...
> Wel maybe someone could help me.
> I'm working with an excisting database using MSSQL, where are 2 T_datetime
> fields.
> If i display these 2 columns i see the date time format as follow:
> Aug 5 2004 6:03PM
> The problem is that i only need de time format like 6:03PM or better if
> possible 18:03.
> Could anybody help mee with these 2 problems.|||$query = " select left(right(convert(varchar(25), PunchIn(), 100), 7), 5)";
//punch in is columname
this is my query what was suggest when i use this i have no output.
"Louis Davidson" wrote:

> What do you mean, if I display these 2 columns? Can you do a select in QA
> and post the results?
> --
> ----
--
> Louis Davidson - drsql@.hotmail.com
> SQL Server MVP
> Compass Technology Management - www.compass.net
> Pro SQL Server 2000 Database Design -
> http://www.apress.com/book/bookDisplay.html?bID=266
> Blog - http://spaces.msn.com/members/drsql/
> Note: Please reply to the newsgroups only unless you are interested in
> consulting services. All other replies may be ignored :)
> "Smarteye" <Smarteye@.discussions.microsoft.com> wrote in message
> news:4EDDC42C-6CCE-4685-B84E-936C177C2E6A@.microsoft.com...
>
>|||What is punchIn() or punchLn(). This is not valid SQL. Can you print what
is in your $query variable and post?
----
Louis Davidson - drsql@.hotmail.com
SQL Server MVP
Compass Technology Management - www.compass.net
Pro SQL Server 2000 Database Design -
http://www.apress.com/book/bookDisplay.html?bID=266
Blog - http://spaces.msn.com/members/drsql/
Note: Please reply to the newsgroups only unless you are interested in
consulting services. All other replies may be ignored :)
"Smarteye" <Smarteye@.discussions.microsoft.com> wrote in message
news:40399FA1-87F5-4D8A-97B9-F1F655F814B7@.microsoft.com...
> $query = " select left(right(convert(varchar(25), PunchIn(), 100), 7),
> 5)";
> //punch in is columname
> this is my query what was suggest when i use this i have no output.
> "Louis Davidson" wrote:
>|||Well it's working,
for one field if i do :
$query = " SELECT left(right(convert(varchar(25), PunchIn,100), 7), 7) FROM
X_PunchIn"; //punch in is columname
it wil display the time good.
but i need to display 2 columns
so i've made a 2nd query :
$query2 = "SELECT left(right(convert(varchar(25), PunchOut,100), 7), 5) FROM
X_PunchIn"; //punch in is columname
but mssql could only display 1 query so i've a problem .
Could any one solve this problem? and the problem AM/PM to 24hours
"Louis Davidson" wrote:

> What is punchIn() or punchLn(). This is not valid SQL. Can you print wha
t
> is in your $query variable and post?
> --
> ----
--
> Louis Davidson - drsql@.hotmail.com
> SQL Server MVP
> Compass Technology Management - www.compass.net
> Pro SQL Server 2000 Database Design -
> http://www.apress.com/book/bookDisplay.html?bID=266
> Blog - http://spaces.msn.com/members/drsql/
> Note: Please reply to the newsgroups only unless you are interested in
> consulting services. All other replies may be ignored :)
> "Smarteye" <Smarteye@.discussions.microsoft.com> wrote in message
> news:40399FA1-87F5-4D8A-97B9-F1F655F814B7@.microsoft.com...
>
>