Re: Seperating a Timestamp
- From: John Spencer <spencer@xxxxxxxxx>
- Date: Tue, 07 Oct 2008 15:17:02 -0400
Try using DateValue and TimeValue functions. Or use Cdate to force conversion of your strings.
In either case you are going to need to make sure you are passing the functions a valid date time string.
IIF(ISDate(StartDate),DateValue(StartDate),Null) as StartedDate
IIF(ISDate(StartDate),TimeValue(StartDate),Null) as StartedDate
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
EAB1977 wrote:
I am hoping someone has had some experience here..
In my query, I need to seperate a Timestamp into two different fields;
a date fiend and a time field. I am successful in seperating the
fields, although they are now strings instead of Date and Time fields.
When I try to query on the date fields, I do not get the data I desire
since they are now string fields.
Is there anyway around this?
SELECT dbo_vwPlant.Name, dbo_Shipment.ID, Sum(dbo_Sleeve.Samples) AS
NumOfSets, Format([StartDate],"mm/dd/yyyy") AS StartedDate,
Format([StartDate],"hh:mm") AS StartedTime, Format([CompletedDate],"mm/
dd/yyyy") AS CompleteDate, Format([CompletedDate],"hh:mm") AS
CompletedTime, dbo_Shipment.AssignedStaffID
FROM dbo_vwPlant INNER JOIN (dbo_Shipment INNER JOIN dbo_Sleeve ON
dbo_Shipment.Key = dbo_Sleeve.ShipmentKey) ON dbo_vwPlant.Code =
dbo_Shipment.PlantCode
WHERE (((dbo_Shipment.ProductLineCode)="0EPS") AND
((dbo_Shipment.OnDemandTestID)=0))
GROUP BY dbo_vwPlant.Name, dbo_Shipment.ID, Format([StartDate],"mm/dd/
yyyy"), Format([StartDate],"hh:mm"), Format([CompletedDate],"mm/dd/
yyyy"), Format([CompletedDate],"hh:mm"), dbo_Shipment.AssignedStaffID,
dbo_Shipment.AssignedStaffID, dbo_Shipment.ID
ORDER BY dbo_Shipment.AssignedStaffID, dbo_Shipment.ID;
- Follow-Ups:
- Re: Seperating a Timestamp
- From: John Spencer
- Re: Seperating a Timestamp
- References:
- Seperating a Timestamp
- From: EAB1977
- Seperating a Timestamp
- Prev by Date: RE: Using a comparison operator in a parameter query
- Next by Date: Re: Creat Table Query
- Previous by thread: RE: Seperating a Timestamp
- Next by thread: Re: Seperating a Timestamp
- Index(es):
Relevant Pages
|