HI there - nice of you to blow the dust of this forum category, it doesn't get much action these days...
When dealing with dates and date formats you can either gamble and roll the dice as you are doing by using date() and now() or write functions to ensure not only the part of the date/time are there but they are in the format you want EG dd/mm/yyyy is essential for Australia. SO:
when I insert a record into SQL Server I like to always store using American mm/dd/yyyy format so I do use this function:
Code:
FUNCTION amDate(varDate)
IF isNull(varDate) OR Trim(varDate) = "" OR varDate = "Null" THEN
amDate = "Null"
ELSE
amDate = "'" & Month(DateValue(varDate)) & "/" & Day(DateValue(varDate)) & "/" & Year(DateValue(varDate)) & " " & TimeValue(varDate) & "'"
END IF
END FUNCTION
and when I get records from the DB I display it using either of these functions, the first one shows just the date and the second one the date and time:
Code:
FUNCTION auDate(varDate)
IF isNull(varDate) OR Trim(varDate) = "" OR varDate = "Null" THEN
auDate = "Null"
ELSE
auDate = "" & Day(DateValue(varDate)) & "/" & Month(DateValue(varDate)) & "/" & Year(DateValue(varDate)) & ""
END IF
END FUNCTION
FUNCTION auDateTime(varDate)
IF isNull(varDate) OR Trim(varDate) = "" OR varDate = "Null" THEN
auDateTime = "Null"
ELSE
auDateTime = "" & Day(DateValue(varDate)) & "/" & Month(DateValue(varDate)) & "/" & Year(DateValue(varDate)) & " " & TimeValue(varDate) & ""
END IF
END FUNCTION
Then once you build your functions up you will use then everywhere....