Date part of Date/Time Field 
Author Message
 Date part of Date/Time Field

Hello All
A quick Question:
How do I reference the Date part of a "Date/Time" field.
i.e.: If my InventoryDate field contains "4/6/99 7:57:12 AM"
How do I reference the "4/6/99" part of it.

Thank you in advance.

    -Jahan



Sat, 22 Sep 2001 03:00:00 GMT  
 Date part of Date/Time Field
On Tue, 6 Apr 1999 08:20:34 +0100, "Jahan K. Jamshidi"

Quote:

>How do I reference the Date part of a "Date/Time" field.
>i.e.: If my InventoryDate field contains "4/6/99 7:57:12 AM"
>How do I reference the "4/6/99" part of it.

Quick answer: Date values are held as double-precision floats, the
integer part represents the date, and the fraction part the time.

  Int(InventoryDate)                  ' returns the date
  InventoryDate - Int(InventoryDate)  ' returns the time part

To be precise, Fix(DateValue) give the correct answer if you are
likely to be using dates prior to 1900, but is less intuitive.

HTH

Tim F

--



Sat, 22 Sep 2001 03:00:00 GMT  
 Date part of Date/Time Field
Jahan,
You reference it as if the time is not there:
If InventoryDate = "#4/6/99#" ....
or to view or print:  Format(InventoryDate, "mm/dd/yyyy")
---
Mike S.
Optimal Systems Corp.  www.oscorp.com
Access Developer Tools
---
Quote:

>Hello All
>A quick Question:
>How do I reference the Date part of a "Date/Time" field.
>i.e.: If my InventoryDate field contains "4/6/99 7:57:12 AM"
>How do I reference the "4/6/99" part of it.

>Thank you in advance.

>    -Jahan



Sat, 22 Sep 2001 03:00:00 GMT  
 Date part of Date/Time Field

Quote:

>Hello All
>A quick Question:
>How do I reference the Date part of a "Date/Time" field.
>i.e.: If my InventoryDate field contains "4/6/99 7:57:12 AM"
>How do I reference the "4/6/99" part of it.

I usually do Int(CVDate(InventoryDateField)). I put in the CVDate call to
avoid illegal data type errors if and when I upsize to SQL Server, etc.

--

WARNING: I cannot be held responsible for the above        They're   coming  to
because  my cats have  apparently  learned to type.        take me away, ha ha!



Sun, 23 Sep 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Problem Using Time Part of a Date-Time field in SQL-Server

2. Display Time part of Date-Time Field?

3. Can I SUM the time part of Date/Time Fields

4. Matching system date/time with field date/time

5. ADO with Access Date/Time field not storing the time, just the date

6. Compare date in form with date/time in form with date/time in database

7. Extracting the date out of a Date/Time field

8. Null date values in Date/Time fields in Access DB

9. CR8 Distinct dates in Date/Time Field

10. date/time field only shows date

11. combining a time and a date to one Date/Time value

12. start date/time, end date/time problem

 

 
Powered by phpBB® Forum Software