Rabu, 28 Desember 2011

Re: [MS_AccessPros] RE: Date field

 

Hi Bill,

I only store date in 3 parts for birthdays, anniversaries, or other dates where parts are known and parts may not be.  I should have made that clear, thanks for bringing it up ;)  Generally, it is best to store date AND time all together.

It is easy to pull parts of a date out.  for instance:

MonthLongName: Format([DateField],"mmmm")
MonthShortName: Format([DateField],"mmm")

MonthNumber: Month([DateField])

~~~

LongYearString: Format([DateField],"yyyy")
ShortYearString: Format([DateField],"yy")

YearNumber: Year([DateField])

You can also use the DatePart dfunction to pull parts out of a date

~~~

now that you have some basic functions, you can combine year and month like this:

YearMonth: Format( [DateField], "yy-mm")

The Format function always returns a string, not a number. 

Year, Month, and Day functions return numbers.

Warm Regards,
Crystal

Access Basics by Crystal (Bill Mosca's site)
http://thatlldoit.com
Free 100-page book that covers essentials in Access

 *
   (: have an awesome day :)
 *

________________________________
From: Duane Hookom


Bill,Not sure of the context of Crystal's "own date field" but a date is a date is a date. I would not consider changing a date field to anything else. I might apply different formats or extract parts of the date with the large number of date related functions. If I was tracking birthdays and had only the day and month (no year), I might consider using fields for day and month since a date field stores the year. Duane HookomMS Access MVP

From: Bill.Singer@at-group.net
Date: Wed, 28 Dec 2011 09:19:03 -0600
Subject: [MS_AccessPros] RE: Date field

     
      I watched one of Crystal's videos and she created her own date field rather

than use the date formatted field that access has.  She created 3 separate

fields for month, day and year.  I am going to be pulling some data out of a

database by month and I am wondering if creating my own date fields is going

to make this easier.  I am thinking it will be easier to pull data for

February if I just run a query for all data where the month equals  "2" and

the year equals  "2012".

Any thoughts?

Bill

Minnesota

[Non-text portions of this message have been removed]

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar