Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / November 2007

Tip: Looking for answers? Try searching our database.

Time returning just the hour

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jason - 01 Nov 2007 18:46 GMT
I have a short time field and I am trying to get the hour portion without the
minutes.
For 17:00 I would like to return 17 and for 07:00 return 07

I have tried the left function but that returns 7: for 7:00 (which makes
sense) but it also returns 5: for 17:00

Can anyone help me return the values before the semicolon. I would like to
end up with 07 and 17

Here is the SQL I have if it helps

SELECT Tbl_UnitHours.UHID, Tbl_UnitHours.ShiftAssignedTo,
Tbl_UnitHours.StartTime, Tbl_UnitHours.EndTime, "(" &
[Tbl_DayofWeek]![DayAbrv] & ")" & [Qry_Stations]![StationAbrv] & "(" &
[Qry_Units]![Unit Abrv] & ")" AS Shift, Left([Tbl_UnitHours]![StartTime],2)
AS Expr1
FROM ((Tbl_UnitHours INNER JOIN Tbl_DayofWeek ON Tbl_UnitHours.DayofWeek =
Tbl_DayofWeek.DayID) INNER JOIN Qry_Stations ON Tbl_UnitHours.Station =
Qry_Stations.StationID) INNER JOIN Qry_Units ON Tbl_UnitHours.Unit =
Qry_Units.UnitID;
KARL DEWEY - 01 Nov 2007 19:00 GMT
Try this --
 Format([Tbl_UnitHours]![StartTime],"hh") AS Expr1

Signature

KARL DEWEY
Build a little - Test a little

> I have a short time field and I am trying to get the hour portion without the
> minutes.
[quoted text clipped - 17 lines]
> Qry_Stations.StationID) INNER JOIN Qry_Units ON Tbl_UnitHours.Unit =
> Qry_Units.UnitID;
Jason - 01 Nov 2007 19:12 GMT
That got it thank you

> Try this --
>   Format([Tbl_UnitHours]![StartTime],"hh") AS Expr1
[quoted text clipped - 20 lines]
> > Qry_Stations.StationID) INNER JOIN Qry_Units ON Tbl_UnitHours.Unit =
> > Qry_Units.UnitID;
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.