Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning date from date/time function

Status
Not open for further replies.

Sillygirl

Programmer
May 3, 2002
80
US
Is there a way to extract just the date out of time/date field?? Something maybe using format??
 
Function DateValue(....) returns date part of date/time argument.
 
combo is correct, and you are correct, it can also be derived by using the Format function:

Format(Now(),"mm/dd/yyyy")

Code on!


[2thumbsup]
Anthony J. DeSalvo
President - ScottTech Software
"Integrating Technology with Business"
 
while we're at it

Fix(now) returns the current year

as does

yearpart = month(now) & "/" & day(now) & "/" & year(now)
 
The date is the integer part of the date/time value so
Int(<datefield>) will give you just the date.

Ken
 
The trouble with int() is that it rounds the result, creating interesting results when it's after 12:00 PM.

Therefore, use fix().
 
I believe the difference between Int and Fix is how they handle negative numbers. There shouldn't be any issue using either one of them with a date value.

Paul
 
You're right, I stand corrected. I was thinking of cint
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top