Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Old 12-03-2005, 12:36 PM Date_Time problem
Experienced Talker

Posts: 30
Trades: 0
I have a guestbook on my site, it orders every post by the time it was posted, latest at the top.

This is what it looks like,

30/11/2005 12:51:26

But recently it has changed, it now does it US style like this

11/30/2005 12:51:26

This means at the moment the newest posts are appearing at the bottom of the page. I've not changed this command or anything so i've got no idea why it's started to show it like this.

Any ideas?

Thanks.
milkman is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-03-2005, 01:14 PM
Experienced Talker

Posts: 30
Trades: 0
I've gone into the Database and made the format General Date, but this still has no effect. I can't see any other way of changing it. I've also tried changing the Input Mask and this has no effect either.

Last edited by milkman; 12-03-2005 at 01:21 PM..
milkman is offline
Reply With Quote
View Public Profile
 
Old 12-03-2005, 03:51 PM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
add
Code:
<%session.LCID = 2057%>
to the top of the page to override the server default of US and apply UK format
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-03-2005, 04:55 PM
Experienced Talker

Posts: 30
Trades: 0
Thanks for the reply.

I tried adding it to the head tags in the submit page and the page where it displays the messages, but it hasn't made any difference. Should I have put it somewhere else?
milkman is offline
Reply With Quote
View Public Profile
 
Old 12-03-2005, 08:04 PM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
It needs to be the first line of ASP code in the page where the date needs to be displayed, and before anyother output.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-03-2005, 08:57 PM
Experienced Talker

Posts: 30
Trades: 0
Still no joy. I've tried adding it at the top of the page just under

<%@ Language="VBScript" %>

Just above where the rest of the code starts and just inside the <% tag where the code starts, but it still displays it US style. Each time i've added a new message to see how it looks, and there's been no change.
milkman is offline
Reply With Quote
View Public Profile
 
Old 12-04-2005, 04:28 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
How are you displaying the date?

Straight from the DB or are you using formatdatetime()
Sounds like it may be the former.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-04-2005, 11:43 AM
Experienced Talker

Posts: 30
Trades: 0
This is the code on the message display page,

Response.write "<tr><td width=""30%"">Posted</td><td width=""70%"">" & oRecordset("Date_Time") & "</td></tr>"

oRecordset being a DIM variable, if that makes sense.

Weird thing is it's just changed for no reason.

Could I substitute Date_Time, with something that specifies the layout?
milkman is offline
Reply With Quote
View Public Profile
 
Old 12-04-2005, 11:57 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Wrap the oRecordset("Date_Time") in the FormatDateTime() function I posted

Code:
FormatDateTime(oRecordset("Date_Time"),dateStyleConstant)
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-04-2005, 12:20 PM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
I'll try and explain how it may have happened BTW.

With IIS each website can run under the context of a different username or under one global username.
Each of these users have their own regional profile created from the master profile on the machine.
Quite possibly your site has been running under a user with a UK regional profile and something has occured to set it into a US one. I'll not try and second guess why because there could be many reasons why it has happened.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-04-2005, 01:01 PM
Experienced Talker

Posts: 30
Trades: 0
I tried that code but I got this error message,

Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'dateStyleConstant'

/guestbook/default.asp, line 239

It's also weird because, the old messages still show up as the UK style, it's just the new ones that are different. Is this a server thing then? could I contact my hosting company and get them to change it?

Thanks a lot for the help, by the way.
milkman is offline
Reply With Quote
View Public Profile
 
Old 12-04-2005, 01:08 PM
Experienced Talker

Posts: 30
Trades: 0
I suppose if it comes to it, I might just have to go into the database each time and change it manually there, not ideal but I suppose it's better than nothing.
milkman is offline
Reply With Quote
View Public Profile
 
Old 12-04-2005, 01:41 PM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
dateStyleConstant is simply a place holder for one of the actual constants

Look at the W3 Schools page I linked to in post no 7 and the constants you can use are listed there

vbShortdate, vbLongDate etc
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-04-2005, 02:03 PM
Experienced Talker

Posts: 30
Trades: 0
Right that had an effect, the dates all now read

for example, 13 November 2005

There's no time after it which would have been nice. But anyway, there's still a problem. The date before the change would have been like this,

12/04/2005

However this is being converted into

12 April 2005

Instead of

4 December 2005

Yesterday the date read

12/03/2005

so the date is correct, it's just being read wrong. It's in the US style but being read as if it's in the UK style.
milkman is offline
Reply With Quote
View Public Profile
 
Old 12-04-2005, 02:40 PM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Yep that is what applying LCID = 2057 does

I think more info is needed
How are the dates stored in the db ?
How do you insert the date/time, you may need to apply the session locale ID to that page as well
Get rid of any formatting that the DB does especially if it's Access.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-04-2005, 03:08 PM
Experienced Talker

Posts: 30
Trades: 0
I've got the <%session.LCID = 2057%> on the page as well, just above where the code starts, and i'm using

FormatDateTime(oRecordset("Date_Time"),vbLongDate)

In the database the dates look like this,

The old correct ones - 13/11/2005 01:53:17

The new ones - 12/04/2005 18:58:43

I've taken out the Formating out of the database, it is Access.

Here's the display page - http://www.milkmansworld.co.uk/default.rar
milkman is offline
Reply With Quote
View Public Profile
 
Old 12-04-2005, 04:11 PM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Can't extract the file for some reason

email the asp file to ForumUsername@ either domain in my signature.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-05-2005, 08:00 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
That was meant as MY forum username (eg chrishirst) not literally ForumUserName, but HeyHo. Fortunately I have the catchall set to bounce the usual crap but filter in other stuff.

Ok I'll make an assumption here as I still don't have all the details
1 - you are using Now() to capture the post time and date

if 1 = true then
use session.LCID = 2057 on the page with the code that captures and stores the date.
The existing DB entries that have the date in mm/dd format will have to be edited to be in a consistent format.
end if

to print out time as well use the same formatdatetime function but use vbShortTime as the format constant.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-05-2005, 09:42 AM
Experienced Talker

Posts: 30
Trades: 0
I did wonder after I sent the email.

It does use Now(), so I added session.LCID = 2057 to that page and suprise suprise, no change.
milkman is offline
Reply With Quote
View Public Profile
 
Old 12-05-2005, 10:34 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
have you edited the database records so they are consistent?

and have you tried adding a new entry to the table to see how it displays and shows in the table?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Date_Time problem

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.63793 seconds with 12 queries