This topic is locked
[SOLVED]

 Date Format

1/20/2011 4:05:33 PM
ASPRunnerPro General questions
J
Jay123 author

Hi!
I am using ASP Runner 6.1.
I would like to ask how can you change the date format of a field which gets it value from another table and is dependent from a dropdown list. I have set that field to Long Date format already and even the source field (from another table) was set to Long date. However, it shows in Short Date (yyyy-mm-dd) format on the Add page.
Example:

Table A: field1 is a dropdown (text); field2 (long date); the value of field2 is dependent on the value of field1

Table B: field3 (long date) - this is where the value of field2 is taken
When I select a value on field1, field2 is in short date format even if I set it to long date.
Thanks,

Jay

J
Jay123 author 1/25/2011

Hi there,
I just like to do a follow up on this.
Thanks,

Jay

Sergey Kornilov admin 1/25/2011

Date formatting is only applied on List/View/Print pages. On Add/Edit pages all data appear the same way it's stored in the database. Date values are always stored as yyyy-mm-dd.

J
Jay123 author 1/25/2011

Hi Sergey,
Can that be overdriven by a Javascript code or there is no workaround at all to change the date format on Add/Edit pages because ASP Runner will ignore whatever code you will apply?
Thanks,

Jay

Sergey Kornilov admin 1/25/2011

No, this cannot be overridden by Javascript. Add/Edit pages always work with what stored in the database.
Do I understand it write that you only need to modify the way date appears in dropdown box? If yes, you can use 'Custom expression' in Lookup wizard settings and format date there using database functions. Don't have a solid advice on how to achieve this though.

J
Jay123 author 1/26/2011

Hi Sergey,
I set the date format in the database as Long Date.
I set that field as "Edit box with Ajax popup" (not dropdown box) in "Edit as" window of ASP Runner Editor because I wanted to make it as read only using javascript code (document.getElementById("display_value_EventDate").readOnly=true;). In the "View as" window of ASP Runner Editor, I also set it as Long Date.
Whatever I do, it always appear as yyyy-mm-dd.
Do you have other suggestions for this?
Thanks,

Jay

Sergey Kornilov admin 1/26/2011

Jay,
there is no such thing as 'Date format in the database'. Dates are always stored as yyyy-mm-dd which is a common date format in database world. You can only change visual representation in your client tool (MS Access?). When ASP page connects to the database dates are always returned in yyyy-mm-dd format.

J
Jay123 author 1/27/2011

Thanks for the clarification, Sergey...