Search Tools Links Login

uk date format


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

Original Author: dominic doherty

Code

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

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 131 times

Categories

ASP/ HTML

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.