Forums
This topic is locked
updating date in english format
Posted 06 Jan 2003 13:44:59
1
has voted
06 Jan 2003 13:44:59 Dave Clarke posted:
HiI have a hidden form field which updates a date field in my database.
the default value of this field when a record is added is in english date format dd/mm/yyyy but when it updates it from the hidden form filed using <b><%= Date() %></b> it is updated in american format mm/dd/yyyy.
I am selecting DATE(MS Access) from the dropdown in the update behaviour dialogue.
How can i get it to update in english format?
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replies
Replied 06 Jan 2003 16:32:03
06 Jan 2003 16:32:03 Stefan P replied:
Hi Dave
Put this at the top of the page (in the code, of course)
<% session.LCID = 2057 %>
should do the trick, it sets a session variable for the date in UK format.
Stefan
UD4 | ASP | VBScript | ACCESS | IIS5
Put this at the top of the page (in the code, of course)
<% session.LCID = 2057 %>
should do the trick, it sets a session variable for the date in UK format.
Stefan
UD4 | ASP | VBScript | ACCESS | IIS5
Replied 07 Jan 2003 14:06:33
07 Jan 2003 14:06:33 Dave Clarke replied:
Thanks Stefan
I've found tho that by selecting DATE rather than DATE (MS Access) it updates in UK format anyway.
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
I've found tho that by selecting DATE rather than DATE (MS Access) it updates in UK format anyway.
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 09 Jan 2003 18:20:29
09 Jan 2003 18:20:29 Dave Clarke replied:
hi
so could this <b><% session.LCID = 2057 %></b> be put in a global.asa rather than on the pages themselves?
thanks
Dave
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
so could this <b><% session.LCID = 2057 %></b> be put in a global.asa rather than on the pages themselves?
thanks
Dave
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 12 Jan 2003 07:53:40
12 Jan 2003 07:53:40 Dave Clarke replied:
This strikes me as strange
When I update the date whilst testing here at home it updates correctly but when updating on the remote server it still updates it in american format.
the remote server is UK based.
This is with <% session.LCID = 2057 %> in a global.asa
any ideas?
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Edited by - Davecl on 12 Jan 2003 07:54:25
When I update the date whilst testing here at home it updates correctly but when updating on the remote server it still updates it in american format.
the remote server is UK based.
This is with <% session.LCID = 2057 %> in a global.asa
any ideas?
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Edited by - Davecl on 12 Jan 2003 07:54:25
Replied 13 Jan 2003 10:50:51
13 Jan 2003 10:50:51 Stefan P replied:
I haven't made changes to the global.asa so don't know much about it, but... are you able to configure it on a remote server that you don't administer?
The other thing is to put the <% session.LCID = 2057 %> on your site's entry page, after all, once the session has been set, it will last for the duration of the visit, so no need to put it in the global.asa?
UD4 | ASP | VBScript | ACCESS | IIS5
The other thing is to put the <% session.LCID = 2057 %> on your site's entry page, after all, once the session has been set, it will last for the duration of the visit, so no need to put it in the global.asa?
UD4 | ASP | VBScript | ACCESS | IIS5
Replied 13 Jan 2003 12:29:22
13 Jan 2003 12:29:22 Dave Clarke replied:
Yes my server allows me to use global.asa but I've been reading up on this session.LCID and it seems that it only alters the way the date is displayed not the way it is entered.
I've tried every different way I can think of to update the date and it still updates it in American format, so I've taken out this part of the code for now.
The original date of the record will have to do.
Thanks
Dave
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
I've tried every different way I can think of to update the date and it still updates it in American format, so I've taken out this part of the code for now.
The original date of the record will have to do.
Thanks
Dave
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 13 Jan 2003 22:52:29
13 Jan 2003 22:52:29 Dennis van Galen replied:
I find that the best way to store dates is just use the default and then display it in whatever format you want, this is extra true for me because inserting a dutch format date into a access dbase can be hairy...it's easy in sql 2000, just change the login language, but with access it's a different story, study this if you want to know more about your options:
msdn.microsoft.com/library/default.asp?url=/library/en-us/off2000/html/acdecDecideWhetherUseDisplayFormattingDataEntryMasS.asp
(make sure you read the mask link at the botton)
Hope that helps.
with regards,
Dennis van Galen
DMXzone Manager
Extension, Tutorial and FAQ's Manager
Studio MX / CFMX PRO / SQL 2000 / NT4 AND win2kPRO / IIS5
msdn.microsoft.com/library/default.asp?url=/library/en-us/off2000/html/acdecDecideWhetherUseDisplayFormattingDataEntryMasS.asp
(make sure you read the mask link at the botton)
Hope that helps.
with regards,
Dennis van Galen
DMXzone Manager
Extension, Tutorial and FAQ's Manager
Studio MX / CFMX PRO / SQL 2000 / NT4 AND win2kPRO / IIS5
Replied 14 Jan 2003 13:54:42
14 Jan 2003 13:54:42 Dave Clarke replied:
Thanks Dennis
I've looked at the link but the problem is not with the input masks etc.
The date is put on the record by default in Access when it creates a new record, this is fine.
The problem is when someone edits a record on the website, in the form that they use to update the record there is a hidden field with the value <%= Date() %> which updates the db field. It is this update that is going into the db in mm/dd/yyyy instead of dd/mm/yyyy which is the default.
I just don't understand why.
I was thinking about using this code to get the current date.
<b>strDate = Date() - <%=(rsetMessages.Fields.Item("flddate"
.Value)%>
strDate = <%=(rsetMessages.Fields.Item("flddate"
.Value)%> + strDate</b>
and then using strDate in the hidden form field to do the update, what do you think?
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
I've looked at the link but the problem is not with the input masks etc.
The date is put on the record by default in Access when it creates a new record, this is fine.
The problem is when someone edits a record on the website, in the form that they use to update the record there is a hidden field with the value <%= Date() %> which updates the db field. It is this update that is going into the db in mm/dd/yyyy instead of dd/mm/yyyy which is the default.
I just don't understand why.
I was thinking about using this code to get the current date.
<b>strDate = Date() - <%=(rsetMessages.Fields.Item("flddate"

strDate = <%=(rsetMessages.Fields.Item("flddate"

and then using strDate in the hidden form field to do the update, what do you think?
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 14 Jan 2003 15:51:44
14 Jan 2003 15:51:44 Dennis van Galen replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
<b>strDate = Date() - <%=(rsetMessages.Fields.Item("flddate"
.Value)%>
strDate = <%=(rsetMessages.Fields.Item("flddate"
.Value)%> + strDate</b>
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
I am not sure that is going to return what you want, have you tried something along the lines of...
<pre id=code><font face=courier size=2 id=code><%
UKdate = DAY(Date()) &"/"& MONTH(Date()) &"/"& YEAR(Date())
%>
<input name="UKdate" type="hidden" value="<%= UKdate%>"></font id=code></pre id=code>
It's just a thought...
But do let me know if it works because it should and using this method you can create every date format you want and it works as you designed it worldwide, no matter if server is set to uk or USA or even japanese.
with regards,
Dennis van Galen
DMXzone Manager
Extension, Tutorial and FAQ's Manager
Studio MX / CFMX PRO / SQL 2000 / NT4 AND win2kPRO / IIS5
<b>strDate = Date() - <%=(rsetMessages.Fields.Item("flddate"

strDate = <%=(rsetMessages.Fields.Item("flddate"

<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
I am not sure that is going to return what you want, have you tried something along the lines of...
<pre id=code><font face=courier size=2 id=code><%
UKdate = DAY(Date()) &"/"& MONTH(Date()) &"/"& YEAR(Date())
%>
<input name="UKdate" type="hidden" value="<%= UKdate%>"></font id=code></pre id=code>
It's just a thought...
But do let me know if it works because it should and using this method you can create every date format you want and it works as you designed it worldwide, no matter if server is set to uk or USA or even japanese.
with regards,
Dennis van Galen
DMXzone Manager
Extension, Tutorial and FAQ's Manager
Studio MX / CFMX PRO / SQL 2000 / NT4 AND win2kPRO / IIS5
Replied 15 Jan 2003 17:10:03
15 Jan 2003 17:10:03 Dave Clarke replied:
Hi
Well the code I gave before was not right, I changed it to this
<b><% strDate = Date() - (rsetadmineditmess.Fields.Item("MessageDate"
.Value)
strDate = (rsetadmineditmess.Fields.Item("MessageDate"
.Value) + strDate %></b>
and it seems to work, although it's a bit untidy <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Your code seems a bit more like it, so I will try that. I'll let you know if it works.
Thanks
Dave
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Well the code I gave before was not right, I changed it to this
<b><% strDate = Date() - (rsetadmineditmess.Fields.Item("MessageDate"

strDate = (rsetadmineditmess.Fields.Item("MessageDate"

and it seems to work, although it's a bit untidy <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Your code seems a bit more like it, so I will try that. I'll let you know if it works.
Thanks
Dave
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 15 Jan 2003 17:49:23
15 Jan 2003 17:49:23 Dave Clarke replied:
Hi
Yes your code works, thanks, updating perfectly now.
Dave
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Yes your code works, thanks, updating perfectly now.
Dave
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 15 Jan 2003 18:27:26
15 Jan 2003 18:27:26 Dennis van Galen replied:
Actually DAY(), MONTH() and YEAR() are SQL Server functions, but obviously ASP works with it happily and that is good because this kind of date building does not work if you use the DATEPART() function, it will return a syntax error.
Sometimes you just have to be creative to get M$ products to do what you want them to do <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
with regards,
Dennis van Galen
DMXzone Manager
Extension, Tutorial and FAQ's Manager
Studio MX / CFMX PRO / SQL 2000 / NT4 AND win2kPRO / IIS5
Sometimes you just have to be creative to get M$ products to do what you want them to do <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
with regards,
Dennis van Galen
DMXzone Manager
Extension, Tutorial and FAQ's Manager
Studio MX / CFMX PRO / SQL 2000 / NT4 AND win2kPRO / IIS5