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!

Inserting a space into a string 1

Status
Not open for further replies.

soulpumpkin

Programmer
Feb 18, 2005
79
0
0
US
I have a asp page that is being saved to excel. I'm using the following code:
Code:
strDate = Now()
strDate = Replace(strDate, "/", "-")
strDate = Replace(strDate, ":", "")
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=" & rs3("Description") & " " &  strDate & ".xls"

Which gives me "Description 10-26-2006 112700 AM" for a file name. I need "Description 10-26-2006 1127 00 AM".

How do I go about adding spaces into the end of the string?

Soul Pumpkin
 
try this:
Code:
<%
strDate = Now()
strDate = Replace(strDate, "/", "-")
intpos = instrrev(strDate,":")
strDate = Replace(mid(strdate, 1, intpos),":","") &" " &Replace(mid(strdate, intpos+1),":"," ")
response.write "Description " & strDate
%>

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top