473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

FormatDateTime question

I set my computer Regional Setting (Control Panel - Regional and
Language Options - Customize - Date) to dd/mm/yy. In my ASP page I do
the following:

FormatDateTime("1/20/07",2)

and it returns 1/20/07 instead of 20/1/07.

I though my setting it to 2, it will display a date using the short
date format specified in your computer's regional settings, how come
it is not ?
How can I set the string to display a date using the computer's
regional setting ?
IIS is running on my machine, I am not on a network, it is just my
machine.

Thank you.

Apr 6 '07 #1
2 9797
wrote on 07 apr 2007 in microsoft.public.inetserver.asp.general:
I set my computer Regional Setting (Control Panel - Regional and
Language Options - Customize - Date) to dd/mm/yy. In my ASP page I do
the following:

FormatDateTime("1/20/07",2)

and it returns 1/20/07 instead of 20/1/07.
I though my setting it to 2, it will display a date using the short
date format specified in your computer's regional settings,
No, not my computer.
ASP FormatDateTime() follows the regional settings of the server(!!)
used.
how come
it is not ?
How can I set the string to display a date using the computer's
regional setting ?
IIS is running on my machine, I am not on a network, it is just my
machine.
I do not know.

My principle is only to use outputs that are independent
of the settings and format them myself.
So no surprises when changing servers:

<% 'vbscript
function myDateFormat(d)
myDateFormat = day(d) & "/" & month(d) & "/" & year(d)
end function

dString = myDateFormat(#2007/01/20#)
nowString = myDateFormat(now)
%>

and never use FormatDateTime(), nor FormatCurrency(),
nor the short version of the year,
and only use the #2007/01/20# string input.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 7 '07 #2
Thank you, that works !
On Apr 7, 3:44 am, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
wrote on 07 apr 2007 in microsoft.public.inetserver.asp.general:
I set my computer Regional Setting (Control Panel - Regional and
Language Options - Customize - Date) to dd/mm/yy. In my ASP page I do
the following:
FormatDateTime("1/20/07",2)
and it returns 1/20/07 instead of 20/1/07.
I though my setting it to 2, it will display a date using the short
date format specified in your computer's regional settings,

No, not my computer.
ASP FormatDateTime() follows the regional settings of the server(!!)
used.
how come
it is not ?
How can I set the string to display a date using the computer's
regional setting ?
IIS is running on my machine, I am not on a network, it is just my
machine.

I do not know.

My principle is only to use outputs that are independent
of the settings and format them myself.
So no surprises when changing servers:

<% 'vbscript
function myDateFormat(d)
myDateFormat = day(d) & "/" & month(d) & "/" & year(d)
end function

dString = myDateFormat(#2007/01/20#)
nowString = myDateFormat(now)
%>

and never use FormatDateTime(), nor FormatCurrency(),
nor the short version of the year,
and only use the #2007/01/20# string input.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Apr 7 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Stevey | last post by:
I have the following XML file... <?xml version="1.0"?> <animals> <animal> <name>Tiger</name> <questions> <question index="0">true</question> <question index="1">true</question> </questions>
7
by: nospam | last post by:
Ok, 3rd or is it the 4th time I have asked this question on Partial Types, so, since it seems to me that Partial Types is still in the design or development stages at Microsoft, I am going to ask...
4
by: Sune | last post by:
Hi, Is there any way to define the default date/time format, instead of having to format every single time you print a date/time? Thanks -- Regards, Sune
3
by: Ekqvist Marko | last post by:
Hi, I have one Access database table including questions and answers. Now I need to give answer id automatically to questionID column. But I don't know how it is best (fastest) to do? table...
10
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
10
by: John K | last post by:
I recently took a job doing PHP but come from an ASP background. I'm trying to find a conversion equivalent for VBScript's "formatdatetime". All I want to do is convert a MySQL datetime field...
5
by: John K | last post by:
I posted on this a week or so ago and found a resolution in that instance by using DATE_FORMAT in my sql string to display the format I was looking for. This time I need to format the date going...
0
by: fiefie.niles | last post by:
I set my computer Regional Setting (Control Panel - Regional and Language Options - Customize - Date) to dd/mm/yy. In my ASP page I do the following: FormatDateTime("1/20/07",2) and it...
1
by: janetopps | last post by:
This is an asp page which adds a template to a mysql database. it returns this error Microsoft VBScript runtime error '800a000d' Type mismatch: 'FormatDateTime' /temps.asp, line 111
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.