Link to home
Start Free TrialLog in
Avatar of dingir
dingirFlag for Sweden

asked on

Mysql/ASP populate forms with wrong dateformat

When the tableformat datetime are loaded into a form (..input type="text"..), it loads as "1/1/2007".
I checked within the mysql table, the dates are stored with the format "2007-01-01", which is the format I want.
The exactly same (ASP) script and form are showing the dates in correct format on my development computer.
The wrong format appear when running it on the customers webhosting.

A little wierd problem that I need some help with.

I've search and found some "conversion scripts" but this is hard to implement because I use sub routines for populating the forms, that does not take care if there are a date, text or integer. Shouldn't there be an easy solution to this? Like setting a codepage or like that??
Avatar of Morcalavin
Morcalavin
Flag of United States of America image

I don't understand why you can't call a format function from a subroutine.  Whenever you insert your date, just run this(say you are doing a response.write):
<%
response.write formatMyDate(Now())

function formatMyDate(myDate)
      formatMyDate = Cstr(DatePart("yyyy",myDate)) & "-" & Cstr(DatePart("m",myDate)) & "-" & Cstr(DatePart("d",myDate))
end function
%>
Avatar of dingir

ASKER

morcalavin,
Thank's for answer!
You mean that manipulating the output is the only way to solve the problem?
If the answer is yes, I will past some code..
ASKER CERTIFIED SOLUTION
Avatar of dingir
dingir
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator