Forums

This topic is locked

UK Date

Posted 07 Mar 2003 17:29:43
1
has voted
07 Mar 2003 17:29:43 Dave Clarke posted:
Hi

This is really annoying now.

I have been using this code (provided by Dennis) for a while now with excellent results

<b>&lt;% varUKdate = DAY(Date()) &"/"& MONTH(Date()) &"/"& YEAR(Date()) %&gt;</b>

then putting varUKdate in a hidden field in a form and using it to update the date in a table.
Like I say this has worked a treat for a few weeks, all my dates going in to the database in uk format dd/mm/yyyy.
Now for some reason, and I haven't altered anything, it has started updating the date in american format mm/dd/yyyy.
If I Response.Write varUKdate on the page it shows up correctly dd/mm/yyyy but when the form updates then it goes wrong.
Any ideas??

perhaps it's because the day and month are in single figures at the moment (beginning of month) and therefore DAY(Date()) is 7 instead of 07 ??, just grasping here<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Dave

ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome

Replies

Replied 07 Mar 2003 18:31:57
07 Mar 2003 18:31:57 Owen Eastwick replied:
Without the leading zeros, there's no difference between some US and UK dates, e.g. 7/7/2003

So, better to format the date, rather than concatenate it out of parts, try this:

&lt;%
varLocale = SetLocale(2057)
varDate = FormatDateTime(Date(), 2)
%&gt;



Regards

Owen.

-------------------------------------------------------------------------------------------
Used programming books and web development software for sale (UK only): www.tdsf.co.uk/tdsfdemo/Shop.htm

Developer services and tutorials: www.drdev.net

Multiple Parameter UD4 / Access 2000 Search Tutorial: www.tdsf.co.uk/tdsfdemo/
Replied 07 Mar 2003 23:11:32
07 Mar 2003 23:11:32 Dennis van Galen replied:
it's better to just trigger the default Dbase date, I updated that article a few weeks back. Still I have no problems with this technique, I still have it running in several places in a application that is now a year into production. It all keeps working fine, even after switching servers.

This was, at the time, just a crude asp/Jscript solution which did the job <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

with kind regards,

Dennis van Galen
DMXzone Manager
FAQ, Tutorial and Extension Manager


Studio MX / CFMX PRO / SQL 2000 / NT4 AND win2kPRO / IIS5
Replied 08 Mar 2003 08:26:53
08 Mar 2003 08:26:53 Dave Clarke replied:
Dennis

I have just tried the NULL thing and I get this error

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

/adminupdatemess.asp, line 110

line 110 is this

If (Not MM_abortEdit) Then
' execute the update
Set MM_editCmd = Server.CreateObject("ADODB.Command"
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
<b>MM_editCmd.Execute</b>
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl &lt;&gt; "" Then
Response.Redirect(MM_editRedirectUrl)

The two lines in your faq are like this
BEFORE YOUR TIP

MM_fieldsStr = "noreason|value|firstname|value|lastname|value|fldusname|value|emailadd|value|phone|value|mobile|value|lookingfor|value|sendcat|value|photpath|value|sendmess|value|thedate|value"
MM_columnsStr = "Reasonfordelete|',none,''|YourFirstName|',none,''|LastName|',none,''|Username|',none,''|YourEMailAddress|',none,''|YourPhoneNumber|',none,''|YourMobilePhoneNumber|',none,''|WhoAreYouLookingFor|',none,''|Category|',none,''|Photos|',none,''|Message|',none,''|MessageDate|',none,NULL"

and after the tip

MM_fieldsStr = "noreason|value|firstname|value|lastname|value|fldusname|value|emailadd|value|phone|value|mobile|value|lookingfor|value|sendcat|value|photpath|value|sendmess|value|thedate|value"
MM_columnsStr = "Reasonfordelete|',none,''|YourFirstName|',none,''|LastName|',none,''|Username|',none,''|YourEMailAddress|',none,''|YourPhoneNumber|',none,''|YourMobilePhoneNumber|',none,''|WhoAreYouLookingFor|',none,''|Category|',none,''|Photos|',none,''|Message|',none,''|MessageDate|',none,DEFAULT"

suggestions please.

thanks

Dave



ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 08 Mar 2003 08:28:18
08 Mar 2003 08:28:18 Dave Clarke replied:
Owen

Not tried yours yet but will do.

Thanks

Dave

ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 08 Mar 2003 21:08:24
08 Mar 2003 21:08:24 Dennis van Galen replied:
Strange, I am beginning to believe it is not possible to achieve this in Access. No matter what I do Access errors or executes without touching the date. Will keep trying things.

with kind regards,

Dennis van Galen
DMXzone Manager
FAQ, Tutorial and Extension Manager


Studio MX / CFMX PRO / SQL 2000 / NT4 AND win2kPRO / IIS5

Edited by - djvgalen on 08 Mar 2003 21:35:41
Replied 09 Mar 2003 07:52:14
09 Mar 2003 07:52:14 Dave Clarke replied:
Thanks anyway Dennis

I think I may just get rid of the updated date and have done with it.<img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>

ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome

Reply to this topic