Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - date format
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

date format

 Post Reply Post Reply
Author
riya_singtel View Drop Down
Newbie
Newbie
Avatar

Joined: 14 March 2005
Location: India
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote riya_singtel Quote  Post ReplyReply Direct Link To This Post Topic: date format
    Posted: 25 April 2005 at 1:40am
I am using a date() function in asp using vb script. It returns the date in the format MM/dd/yyyy. Whereas I need it in dd/MM/yyyy.
 
I changed the date format of my computer to dd/MM/yyyy by going to Control panel ->Regional and Language Options.
 
It still displays the date in MM/dd/yyyy.
What can  be the reason?
Thanks


Edited by riya_singtel - 25 April 2005 at 1:41am
Back to Top
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote ub3rl337ch3ch Quote  Post ReplyReply Direct Link To This Post Posted: 25 April 2005 at 8:38pm
the date function inherently returns the computer dat in mm/dd/yyyy format, i believe. You need to find a script to format the date, like the Int() or FormatNumber() functions. I don't have one off hand though.
Back to Top
riya_singtel View Drop Down
Newbie
Newbie
Avatar

Joined: 14 March 2005
Location: India
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote riya_singtel Quote  Post ReplyReply Direct Link To This Post Posted: 26 April 2005 at 12:14am
Got this from http://www.codetoad.com/asp/format_date_time.asp
 
 
You can use the session.lcid property to change the formatting of the date and time.

For example
<%session.lcid=2057%>
will set the date and time to UK format (DD/MM/YYYY instead of MM/DD/YYYY ) Here's a list of international locales. Bear in mind that setting these will also change currency formatting.
.....had been to this page before but somehow never noticed it then.
Thanks a lot
Back to Top
riya_singtel View Drop Down
Newbie
Newbie
Avatar

Joined: 14 March 2005
Location: India
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote riya_singtel Quote  Post ReplyReply Direct Link To This Post Posted: 26 April 2005 at 2:05am
I am using
<%session.lcid=2057%>
as mentioned in the above post. It displays the date in dd/mm/yyyy format 
But it gives one problem..whenever the date value is less than 13 it automatically converts it to mm/dd/yyyy format.
eg. i have a textbox where i have to enter the date.if i enter 01/03/2005 i.e 1st march in the database it stores it as 03/01/2005 i.e 3rd Jan
what can be the reason for this?
 
Back to Top
C.P.A. View Drop Down
Newbie
Newbie


Joined: 26 April 2005
Location: Netherlands
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote C.P.A. Quote  Post ReplyReply Direct Link To This Post Posted: 26 April 2005 at 10:23am
use Session.LCID = 1043 instead
Back to Top
riya_singtel View Drop Down
Newbie
Newbie
Avatar

Joined: 14 March 2005
Location: India
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote riya_singtel Quote  Post ReplyReply Direct Link To This Post Posted: 26 April 2005 at 9:05pm
1043 is for dutch format and it still does not work while i am making a query to the database
Back to Top
Phat View Drop Down
Senior Member
Senior Member


Joined: 23 February 2003
Status: Offline
Points: 386
Post Options Post Options   Thanks (0) Thanks(0)   Quote Phat Quote  Post ReplyReply Direct Link To This Post Posted: 26 April 2005 at 11:17pm
try


<%

'================Format a date to the correct format=======================

Function AUSDate (str)

'Declaring the variables
Dim aDay
Dim aMonth
Dim aYear


If Len(Trim(str)) > 1 Then

    aDay = Day(str)
    aMonth = Monthname(Month(str),True)
    aYear = Year(str)
    AUSDate = aDay & "-" & aMonth & "-" & aYear

Else

    AUSDate = ""
   
End IF

End Function


%>

Back to Top
C.P.A. View Drop Down
Newbie
Newbie


Joined: 26 April 2005
Location: Netherlands
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote C.P.A. Quote  Post ReplyReply Direct Link To This Post Posted: 27 April 2005 at 7:23am
Originally posted by riya_singtel riya_singtel wrote:

1043 is for dutch format and it still does not work while i am making a query to the database


Sorry you are right, but it should work for the database queries as well, make sure you use it through the entire process. (At least with me it has always worked just fine)
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.