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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateTime format pls

Status
Not open for further replies.

damipera

Technical User
Dec 1, 2005
134
GB
hi can anybody help me here pls. i've got this code and writes date in this format: '01 June 2006'. I want this to be written in this format: 'July 2006', how can i achieve this? thanks

Code:
.
.
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>					
function DoDateTime(str, nNamedFormat, nLCID)				
	dim strRet								
	dim nOldLCID								
										
	strRet = str								
	If (nLCID > -1) Then							
		oldLCID = Session.LCID						
	End If									
										
	On Error Resume Next							
										
	If (nLCID > -1) Then							
		Session.LCID = nLCID						
	End If									
										
	If ((nLCID < 0) Or (Session.LCID = nLCID)) Then				
		strRet = FormatDateTime(str, nNamedFormat)			
	End If									
										
	If (nLCID > -1) Then							
		Session.LCID = oldLCID						
	End If									
										
	DoDateTime = strRet							
End Function									
</SCRIPT>
.
.


<%= DoDateTime((rsDatefield.Fields.Item("pub_date").Value), 1, 2057) %>
.
.
 

Code:
Function fdate(strdate)
if isdate(strdate) then fdate = MonthName(DatePart("m",strdate)) & " " &  DatePart("yyyy",strdate)
End Function

Dim str
str = "01 June 2006"

response.write fdate(str)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top