S
Simon Harris
Hi All,
I'm having problems with date formats, on a report, they always seem to be
displayed as mm/dd/yyyy (US Format) what I need is British format
(dd/mm/yyyy). It works Ok, when the day is over 12. (As expected)
- Regional settings OK
- Table column datatype is Date/Time
- Table column format is short date, which on the drop down shows as
dd/mm/yyyy
- Report field formatted as short date
I've also tried format(DateField,"dd/mm/yyyy") which strangly makes no
difference!
My test code below returns the same value for each MsgBox, both with the
date as mm/dd/yyyy
Private Sub Command1_Click()
Dim Conn As DAO.Database
Dim strSQL As String
Dim RSTest As DAO.Recordset
Set Conn = CurrentDb
strSQL = "select reading_date from qry_invoices where idinvoice = 805"
Set RSTest = Conn.OpenRecordset(strSQL)
MsgBox (RSTest("reading_date"))
MsgBox (Format(RSTest("reading_date"), "dd/mm/yyyy"))
End Sub
But...this code seems to work AOK, in fact both msgbox's display the correct
date format:
Dim aDate As Date
aDate = CDate("01/07/2006")
MsgBox (aDate)
MsgBox (Format(aDate, "dd/mm/yyyy"))
Do I need to format the date on the way into the database? As I understand
it, date values are stored as:
"The date is not "stored" in ANY format: it's stored as a double float
count of days and fractions of a day (times) since midnight, December
30, 1899."
(Thanks John Vinson for the info on a reply to an earlier thread!)
I dont geddit!! Help! (Please!)
Cheers ;-)
Simon.
--
-
* Please reply to group for the benefit of all
* Found the answer to your own question? Post it!
* Get a useful reply to one of your posts?...post an answer to another one
* Search first, post later : http://www.google.co.uk/groups
* Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!
I'm having problems with date formats, on a report, they always seem to be
displayed as mm/dd/yyyy (US Format) what I need is British format
(dd/mm/yyyy). It works Ok, when the day is over 12. (As expected)
- Regional settings OK
- Table column datatype is Date/Time
- Table column format is short date, which on the drop down shows as
dd/mm/yyyy
- Report field formatted as short date
I've also tried format(DateField,"dd/mm/yyyy") which strangly makes no
difference!
My test code below returns the same value for each MsgBox, both with the
date as mm/dd/yyyy
Private Sub Command1_Click()
Dim Conn As DAO.Database
Dim strSQL As String
Dim RSTest As DAO.Recordset
Set Conn = CurrentDb
strSQL = "select reading_date from qry_invoices where idinvoice = 805"
Set RSTest = Conn.OpenRecordset(strSQL)
MsgBox (RSTest("reading_date"))
MsgBox (Format(RSTest("reading_date"), "dd/mm/yyyy"))
End Sub
But...this code seems to work AOK, in fact both msgbox's display the correct
date format:
Dim aDate As Date
aDate = CDate("01/07/2006")
MsgBox (aDate)
MsgBox (Format(aDate, "dd/mm/yyyy"))
Do I need to format the date on the way into the database? As I understand
it, date values are stored as:
"The date is not "stored" in ANY format: it's stored as a double float
count of days and fractions of a day (times) since midnight, December
30, 1899."
(Thanks John Vinson for the info on a reply to an earlier thread!)
I dont geddit!! Help! (Please!)
Cheers ;-)
Simon.
--
-
* Please reply to group for the benefit of all
* Found the answer to your own question? Post it!
* Get a useful reply to one of your posts?...post an answer to another one
* Search first, post later : http://www.google.co.uk/groups
* Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!