Re: Date confusion
- From: "matt -`;'-" <mbox1@xxxxxxxxxx>
- Date: Sat, 10 Sep 2005 03:36:02 -0400
"Ace9x" <Ace9x@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:AB5E3A45-94AD-4D46-8E23-9CA35AC56FED@xxxxxxxxxxxxxxxx
> I have created a function in the Main module in Access, which when called
> with a Financial Year parameter creates 52 weekly entries in a table with
> period no as 1 to 52, start and end date. This seems okay until I view the
> new entries in the table. Some of the dates are displayed in dd/mm/yyyy
> format whilst others appear in mm/dd/yyyy format. There are no format or
> input masks present on the table itself.
> For the sql insert statement of the 2 dates I used :-
>
> "#" & format(dteStart,"dd/mm/yyyy") ",#" & format(dteEnd,"dd/mm/yyyy") &
> "#"
>
> Obviously something is wrong either with the insert SQL or the display of
> the dates in the table, can someone please advise appropriately.
>
> Cheers,
> Steve
The dates you are probably working with are a numeric value that the program displays in a date format like m/d/y. The actual date
value is a 5 digit Long Integer.
If you are working with a numeric date and you want the format DDMMYYYY, then you will need to store the dates you use as String
representations of a date in the Table. (The data type in the table will be text instead of date.) Visually this will look the
same to you, but to the program it will see a Text String and will keep it properly formatted to dd/mm/yyyy. If you need to perform
math on the dates then you will need to convert them back to date values. See below for both methods.
'--Convert a numeric date value to a string date value
Format(CStr(dteStart),"dd/mm/yyyy")
'--Convert a string date value formatted as DD/MM/YYYY to a numeric date value
DateValue(Mid(strDate,4,2) & "/" & Left(strDate,2) & "/" & Right(strDate,4))
Good luck, matt
.
- Follow-Ups:
- Re: Date confusion
- From: Douglas J. Steele
- Re: Date confusion
- Prev by Date: Import semicolon delimited varied column file - need help
- Next by Date: Re: Date confusion
- Previous by thread: Import semicolon delimited varied column file - need help
- Next by thread: Re: Date confusion
- Index(es):
Relevant Pages
|