Date/Time Field

  • Thread starter Thread starter M. Hamzah Khan
  • Start date Start date
M

M. Hamzah Khan

Hi everyone

Umm seem to have another problem :S.

Using a data/time field, if I specify the format as yyyy do i still have
to enter the day/month aswell? because it doesn't seem to let me enter
just the year.

Hamzah Khan
 
Hi everyone

Umm seem to have another problem :S.

Using a data/time field, if I specify the format as yyyy do i still have
to enter the day/month aswell? because it doesn't seem to let me enter
just the year.

Hamzah Khan

Yes. A DateTime datatype must be a complete valid date... month, day,
year.

You can display the date as just yyyy, but it must be a complete date.
 
Hi everyone

Umm seem to have another problem :S.

Using a data/time field, if I specify the format as yyyy do i still have
to enter the day/month aswell? because it doesn't seem to let me enter
just the year.

Hamzah Khan
The answer is yes.

Open any database and press Ctrl-G.
Copy this into the Immediate window.
Go the the end of any expression and press
enter to run it.

?DATEDIFF("d",0,NOW())
39236
?DATEADD("d",39236,0)
6/3/2007
?FORMAT(DATEADD("d",DATEDIFF("d",0,NOW()),0),"yyyy")
2007

?DATEDIFF("s",0,TIME())
65095
?DATEADD("s",65095,0)
6:04:55 PM

What's the point? It illustrates that dates are
simply numbers. FORMAT is just a way to display
a date, number if you will, one particular way.
FORMAT converts a number to a string for display.

Thinking of dates this way really helped my understanding.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top