Formating fields in a database
Hello,
Have a quick question regarding the format of a field in a database.
The database is a MSACCESS 2000 database which has a few tables, one of the fields within the table is a date/time field.
Currently it is set as the following in the Datasheet View
04/03/01 07:58:47
In the Design View it is set to DATE/TIME, in the general part it says GENERAL DATE
Now if you look at the following web page
http://www.britishpolio.co.uk/messageboard/default.asp
Sometimes it reverts to American format and sometimes to British format
Some of the dates are in American format and some are in British format, I need to know how I can make all of them British format
Thank you in advance
Hitesh
Peter J. Boettcher posted this at 14:46 — 3rd April 2001.
They have: 812 posts
Joined: Feb 2000
Hitesh,
I had a look at the website and all the date/time strings looked like they were in the same format. I'm not sure what you mean by British format, could you elaborate on that.
For formatting you can modify the date/time field in access to display a format you're happier with, or you can format it with ASP using built in functions like MonthName/WeekdayName/Year etc.
PJ | Are we there yet?
pjboettcher.com
hitesh posted this at 15:11 — 3rd April 2001.
They have: 6 posts
Joined: Mar 2001
Hi,
Under the heading on Last Post sometimes it says the following
01/03/22 02:48:08
yy/mm/dd - american format?
22/03/01 02:48:08
dd/mm/yy - british format?
Hope this makes sense??
I will have to wait and see, the date format changes sometimes when someone posts a new message, I'll just have to wait and see if this happens.
Hitesh
Peter J. Boettcher posted this at 15:23 — 3rd April 2001.
They have: 812 posts
Joined: Feb 2000
That is strange, looks like maybe you're getting some people with different regions posting stuff and you're not formatting the date/time before you save it. Access should be translating this to the proper format but it's not.
Maybe try using FormatDateTime to clean up the date when saving/displaying it. ASP Sample:
<?php
Response.Write "Posted on: " & FormatDateTime(AccessRS("General_Date"),2)
?>
FormatDateTime uses the regional settings on the server to display the date/time so if your server is in the UK then I would think it should display this in the right format.
PJ | Are we there yet?
pjboettcher.com
hitesh posted this at 15:25 — 3rd April 2001.
They have: 6 posts
Joined: Mar 2001
Thanks
Will try that,
Hitesh
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.