close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Formatting date fields (.asp)

Thread began 1/29/2010 8:15 am by suarezm129397438 | Last modified 2/08/2010 5:17 pm by Jason Byrnes | 1822 views | 4 replies |

suarezm129397438

Formatting date fields (.asp)

In my DataAssist update form I have a date and time field that is not editable but displays on the form. How do I format these two fields so that they display correctly?

This is the code on the update form:

<tr>
<th class="WADADataTableHeader">Enroll Date:</th>
<td class="WADADataTableCell"><%=String(WADAparticipant_data.Fields.Item("enroll_date").Value==null?"":(WADAparticipant_data.Fields.Item("enroll_date").Value)).replace(/"/g, '&quot;')%></td>
</tr>
<tr>
<th class="WADADataTableHeader">Enroll Time:</th>
<td class="WADADataTableCell"><%=String(WADAparticipant_data.Fields.Item("enroll_time").Value==null?"":(WADAparticipant_data.Fields.Item("enroll_time").Value)).replace(/"/g, '&quot;')%></td>
</tr>

This is how the date and time field display on the form:

Date: Thu Jan 28 00:00:00 EST 2010
Time:Sat Dec 30 21:43:31 EST 1899

The date and time on the access database are:
Date: 1/28/2010
Time: 9:43:31 PM

Sign in to reply to this post

Eric Mittman

I'm not very familiar with date formatting in asp but if you can post a sample of the data you are working with in an access db I can try to see if can get the date formatting differently or if there is another way to go about it.

Sign in to reply to this post

Jason ByrnesWebAssist

change your code:

<tr>
<th class="WADADataTableHeader">Enroll Date:</th>
<td class="WADADataTableCell"><%=String(WADAparticipant_data.Fields.Item("enroll_date").Value==null?"":(WADAparticipant_data.Fields.Item("enroll_date").Value)).replace(/"/g, '&quot;')%></td>
</tr>
<tr>
<th class="WADADataTableHeader">Enroll Time:</th>
<td class="WADADataTableCell"><%=String(WADAparticipant_data.Fields.Item("enroll_time").Value==null?"":(WADAparticipant_data.Fields.Item("enroll_time").Value)).replace(/"/g, '&quot;')%></td>
</tr>





to:

<tr>
<th class="WADADataTableHeader">Enroll Date:</th>
<td class="WADADataTableCell"><%=String(WADAparticipant_data.Fields.Item("enroll_date").Value==null?"":DoDateTime((WADAparticipant_data.Fields.Item("enroll_date").Value)).replace(/"/g, '&quot;'), 2, 1033)%></td>
</tr>
<tr>
<th class="WADADataTableHeader">Enroll Time:</th>
<td class="WADADataTableCell"><%=String(WADAparticipant_data.Fields.Item("enroll_time").Value==null?"":DoDateTime((WADAparticipant_data.Fields.Item("enroll_time").Value)).replace(/"/g, '&quot;'), 3, 1033)%></td>
</tr>
Sign in to reply to this post

suarezm129397438

I made the changes you suggested but now I'm getting this error:
______________________________________________
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

Technical Information (for support personnel)

Error Type:
Microsoft JScript runtime (0x800A138F)
Object expected
______________________________________________

Help!

Sign in to reply to this post

Jason ByrnesWebAssist

try this instead:

<tr>
<th class="WADADataTableHeader">Enroll Date:</th>
<td class="WADADataTableCell"><%=DoDateTime(String(WADAparticipant_data.Fields.Item("enroll_date").Value==null?"":(WADAparticipant_data.Fields.Item("enroll_date").Value)).replace(/"/g, '&quot;'), 2, 1033)%></td>
</tr>
<tr>
<th class="WADADataTableHeader">Enroll Time:</th>
<td class="WADADataTableCell"><%=DoDateTime(String(WADAparticipant_data.Fields.Item("enroll_time").Value==null?"":(WADAparticipant_data.Fields.Item("enroll_time").Value)).replace(/"/g, '&quot;'), 3, 1033)%></td>
</tr>
Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...