|
| |
|
|
box
Posts: 117 Joined: 12/10/2002 Status: offline
|
<%=date%> - 2/3/2008 18:49:54
<%=date%> gives 2/3/2008 format I need to get 02/03/2008 format any idea please?
< Message edited by box -- 2/3/2008 18:55:18 >
|
|
|
|
rdouglass
Posts: 9167 From: Biddeford, ME USA Status: offline
|
RE: <%=date%> - 2/4/2008 13:39:48
<% function fixTheDate(dateIn)
tempText = ""
If IsDate(dateIn) Then
If len(DatePart("d",dateIn)) = 1 Then
tempText = tempText & "0" & DatePart("d",dateIn) & "/"
Else
tempText = tempText & DatePart("d",dateIn) & "/"
End If
If len(DatePart("m",dateIn)) = 1 Then
tempText = tempText & "0" & DatePart("m",dateIn) & "/"
Else
tempText = tempText & DatePart("m",dateIn) & "/"
End If
fixTheDate = tempText & DatePart("yyyy",dateIn)
else ' if not a date, send back an empty string
fixTheDate = ""
end if
end function
response.write(fixTheDate(Date())
%> Something like that maybe?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
box
Posts: 117 Joined: 12/10/2002 Status: offline
|
RE: <%=date%> - 2/6/2008 2:41:57
Thanks, it works great, the problem is if I use it as hidden value in the form I get syntax error!!! <% function fixTheDate(dateIn) tempText = "" If IsDate(dateIn) Then If len(DatePart("d",dateIn)) = 1 Then tempText = tempText & "0" & DatePart("d",dateIn) & "/" Else tempText = tempText & DatePart("d",dateIn) & "/" End If If len(DatePart("m",dateIn)) = 1 Then tempText = tempText & "0" & DatePart("m",dateIn) & "/" Else tempText = tempText & DatePart("m",dateIn) & "/" End If fixTheDate = tempText & DatePart("yyyy",dateIn) else ' if not a date, send back an empty string fixTheDate = "" end if end function response.write(fixTheDate(Date())) %>
|
|
|
|
rdouglass
Posts: 9167 From: Biddeford, ME USA Status: offline
|
RE: <%=date%> - 2/6/2008 8:31:07
quote:
the problem is if I use it as hidden value in the form I get syntax error!!! What specifically is the error and what is the line it errors on?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
rdouglass
Posts: 9167 From: Biddeford, ME USA Status: offline
|
RE: <%=date%> - 2/6/2008 18:46:37
You're not putting that whole thing in the textbox value are you? You'd put the function itself at the top of the page and call it where you need to fix that date. Can you post the code and show me how you're using it? The 10 or 15 lines above and below as well if you please.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
box
Posts: 117 Joined: 12/10/2002 Status: offline
|
RE: <%=date%> - 2/7/2008 1:29:20
Thanks a lot is working great now, <%response.write(fixTheDate(Date()))%>
< Message edited by box -- 2/7/2008 1:44:14 >
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|