VB icon

uk date format

Email
Submitted on: 1/6/2015 10:03:00 PM
By: dominic doherty (from psc cd)  
Level: Beginner
User Rating: By 2 Users
Compatibility: ASP (Active Server Pages)
Views: 548
 
     if when you want to use the date function and you do not want the continental style but the english then this code sorts it for you. very simple and easy to understand
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: uk date format
' Description:if when you want to use the date function and you do not want the continental style but the english then this code sorts it for you. very simple and easy to understand
' By: dominic doherty (from psc cd)
'**************************************

dim datetoday
'this is the variable that is made from the 
'other three variables below. insert this 
'variable in your code where you want the
'date to be displayed
dim nowday 'variable for today
dim nowmonth 'variable for current month
dim nowyear 'variable for current year
nowday =DatePart("D", Date) 'gets day number
nowmonth=DatePart("M", Date) 'gets month number
nowyear= DatePart("YYYY", Date) 'gets year
if nowday >=10 then
datetoday = nowday & "/" & nowmonth& "/"& nowyear
else nowday = "0" & nowday
'if the day number is less than 10 then a 0 is 
'added infornt ie 8 goes to 08
end if 
'the same is true below but for month number
if nowmonth >=10 then 
datetoday = nowday & "/" & nowmonth& "/"& nowyear
else nowmonth = "0" & nowmonth
datetoday = nowday & "/" & nowmonth& "/"& nowyear
end if
'now you just insert the date where you want ie
response.write datetoday
'just trying to help beginners with small problems
hope it is helpful


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


 There are no comments on this submission.
 

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.