Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Date formats

Status
Not open for further replies.

crabgrass

Technical User
Aug 29, 2007
111
US
Is there a global setting for date formats? If I select a date field that is empty I get "12:00:00" as the output value. Is there a way to format this as a blank without building a long list of if statements? (I have 40 of these on the page.)

Thanks
 
Can you please explain this a little more?

Are you getting data from a database? And in that database, the DateField is 'blank'? So, when you display the data on the page, it's showing '12:00 AM'? Do I understand this correctly?

-George

"the screen with the little boxes in the window." - Moron
 
The data is coming from a visual foxpro database table using a SELECT statement. The field is defined as a date. If the field is empty the return value is a zero (0) and is displayed as "12:00:00" in the textbox.
 
Can you show the line where you are displaying the value from the database on your web page?

-George

"the screen with the little boxes in the window." - Moron
 
Here 'tis
<%sql = "select * from tip where tip_id = " & lcTIP_id
Set oProject = oConn.Execute(sql)%>

followed by a table with:

<td><input type="text" name="" value="<%=oProject("s_scoping")%>"></td>


s_scoping is a date field
 
If the return value from the DB is a zero, then format your textbox to account for that. Something like this:
Code:
<%
dim myValue
if rs.fields("myDateField") = 0 then
  myValue = ""
else
  myValue = FormatDateTime(rs.fields("myDateField"),vbShortDate)
end if 
%>

[COLOR=green]'This will do the textbox[/color]
<input type="text" name="txtTest" value="<%=myValue%>">

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top