Important alert: (current site time 7/15/2013 10:19:21 PM EDT)
 

VB icon

[ Long Date : March 8, 2002 ]

Email
Submitted on: 3/8/2002 3:28:46 AM
By: snowboardr 
Level: Beginner
User Rating: By 7 Users
Compatibility: ASP (Active Server Pages)
Views: 22062
(About the author)
 
     This writes out the full date with the month as a word. If there is a better way to do this let me know. Leave comments if you want.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
'**************************************
' Name: [ Long Date : March 8, 2002 ]
' Description:This writes out the full date with the month as a word. If there is a better way to do this let me know. Leave comments if you want.
' By: snowboardr
'
' Assumes:PWS / IIS
'
'This code is copyrighted and has' limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=7318&lngWId=4'for details.'**************************************

Function WriteLongDate()
'//By Jason Howard
'//March 8, 2002
Dim ThisMonth
Dim ThisDay
Dim ThisYear
ThisMonth = month(date)
ThisDay = day(date)
ThisYear = year(date)
Select Case ThisMonth
	Case 1
	 ThisMonth = "January"
	Case 2
			ThisMonth = "February"
	Case 3
		 	ThisMonth = "March"
	Case 4
			ThisMonth = "April"
	Case 5
			ThisMonth = "May"
	Case 6
			ThisMonth = "June"
	Case 7
			ThisMonth = "July"
	Case 8 
			ThisMonth = "August"
	Case 9
			ThisMonth = "September"
	Case 10
			ThisMonth = "October"
	Case 11
			ThisMonth = "November"
	Case 12
			ThisMonth = "December"
End Select
Response.write(ThisMonth) & " " & ThisDay & ", " & ThisYear
set ThisMonth = Nothing
set ThisDay = Nothing
set ThisYear = Nothing
End Function
'To output this just do this anywhere on your page:
<% WriteLongDate %>


Other 21 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

3/8/2002 9:13:07 PMRandy McCleary

Hey here's a better way to do what you just did with the date, and the code is a lot shorter.
<% 'March 8, 2002
Dim strDate
strDate = Split (FormatDateTime(Date,1),",",2)
Response.Write ( strDate(1) )
%>
(If this comment was disrespectful, please report it.)

 
3/14/2002 5:22:22 AMMark Prichard

I liked the format ... So I used this to function to return any date .. just pass the date(dd/mm/yyyy)

<%
Function LngDate(x)
Dim AnyMonth
Dim AnyDay
Dim AnyYear
Dim datex
datex = split(x,
(If this comment was disrespectful, please report it.)

 
3/14/2002 5:49:02 AMJack

Friends,

This is better than all of these!

<%Response.Write MonthName(Month(date))& " " & Day(Date) & ", " & Year(Date) %>

Keep up the good work guys,
Love,
Jack.
(If this comment was disrespectful, please report it.)

 
4/18/2002 5:24:19 PMbateman

what about:

<%=FormatDateTime(Date, vbLongDate) %>
(If this comment was disrespectful, please report it.)

 
6/13/2002 9:58:31 AMwinterwolf

A version in JS:

<%
// Convertir une date en
// Format: 01 janvier, 2002

function convertDate(oldDate)
{
var monthName = new Array("janvier", "février", "mars",
"avril", "mai", "juin",
"juillet", "août", "septembre",
"octobre", "novembre", "décembre");

var date = new Date(oldDate);
var newDate = "Date de mise à jour: ";
newDate += date.getDate();
newDate += " ";
newDate += monthName[date.getMonth()];
newDate += ", ";
newDate += date.getFullYear();
Response.Write(newDate);
}
%>
(If this comment was disrespectful, please report it.)

 
6/21/2002 10:02:43 PMZash

bateman, you are the man! lol, that was soo simple... yours is the best od
(If this comment was disrespectful, please report it.)

 
7/9/2002 10:16:32 PMhung

I want to display week of month (eg: week 1, week 2,...., week 4), can you help me? Thanks
(If this comment was disrespectful, please report it.)

 
11/24/2002 1:45:29 PMZap The Dingbat

I dont know whats wrong with monthName(date) ?
(If this comment was disrespectful, please report it.)

 
8/12/2003 2:21:19 AMWayne & Carr Barron

[bateman];
You rock man, This is great. Easy "1" liner. Works like a charm.

Thank You

Wayne & Carr Barron
Carrz-Fox-Fire Promotions
(If this comment was disrespectful, please report it.)

 
4/22/2004 3:45:19 AM

sir, i need code for differnce of 2 dates means,i want to calculate some operation which i have made already but not getting logic of differnce past date and present date. dates which

(If this comment was disrespectful, please report it.)

 
5/1/2005 8:33:37 PM

wot if i want to retrive date from access database using SQL command in ASP?? have any answer??? pls reply back me at sanmah83@yahoo.com
(If this comment was disrespectful, please report it.)

 
11/30/2005 7:23:33 AMMarre

Or why not:
<%=FormatDateTime(Now,1)%>
(If this comment was disrespectful, please report it.)

 
9/25/2007 5:47:55 PMJHarrod

code for difference of 2 dates:

Day Difference
--------------

DateDiff(d,"StartDate","EndDate")

Week Difference
---------------

DateDiff(ww,"StartDate","EndDate")

Month Difference
----------------

DateDiff(m,"StartDate","EndDate")

Year Difference
---------------

DateDiff(y,"StartDate","EndDate")
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.