Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 528
  • Last Modified:

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??
  • 2
1 Solution
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
dingirAuthor Commented:
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..
dingirAuthor Commented:

Session.LCID = 1053

(for swedish)
In the top of the page, did it all. Thank's a lot, I found that answer myself.
Closed, 500 points refunded.
Community Support Moderator

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now