Click to See Complete Forum and Search --> : Convert the time format


Foundas
03-14-2006, 02:30 AM
Hi guys,

i am using the now() function to get the current date. The problem is that, locally, on IIS, the date is shown in the format of DD/MM/YYYY but when i upload it to the hoster, it is shown as MM/DD/YYYY


how can i make the time format to be shown as DD/MM/YYYY on the host server as well?


thanking you in advance


Foundas

Ubik
03-14-2006, 12:55 PM
You are displaying a date using the short date format specified in your computer's regional settings.

Either change the settings on your server, or you gotta write a function to display it the way you want it.

JayM
03-14-2006, 03:56 PM
Make sure you understand the use of the Now() function. It gives you the date of the Web Server, and not the user's date and time. So if you wish to display your webserver's date to visitors, then use Now(). However, if you wish to display the visitors date according to their computer, use date().

Just replace Now() with Date()

<%
Dim strDate, strDay, strMonth, strYear

strDate = Now()
strDay = Day(strDate)
strMonth = Month(strDate)
strYear = Year(strDate)

Response.Write ("The date using DDMMYYYY is " & strDay & "/" & strMonth & "/" & strYear)
%>


Cheers