Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Classic ASP versions(v3.4.XX)
 Date format problems
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Ric
Starting Member

United Kingdom
47 Posts

Posted - 26 October 2004 :  07:54:12  Show Profile
Hi all,

I'm working on my mod and have got a problem with date formats. The forum is set to "UK short" date format and this is reflected in any posts on the main Snitz forum. However, when using the Snitz StrToDate function to display dates in the mod, the date comes out in US format!?!?

I'm storing the dates as strings in the DB in the format YYYYMMDDHHMMSS. I'm assuming this is correct after looking in the Snitz tables to check how the dates were stored.

<scratching head> Any help would be appreciated!
thanks
Ric

New Photo Album Mod demo

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 26 October 2004 :  17:27:48  Show Profile  Send ruirib a Yahoo! Message
StrToDate will return the date in the format being used by the server, not the format you configured the forum to show the dates. StrToDate should not be used to display a date. If you want to display the date, get the result from StrToDate and then use the VbScript functions Year, Month and Day to get the date components from that result, and then show them as you wish.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

Ric
Starting Member

United Kingdom
47 Posts

Posted - 27 October 2004 :  14:05:02  Show Profile
Thanks for the reply ruirib. I did notice that StrToDate checked the server date format which was why I chose to use it. The server is configured for UK dates, yet StrToDate still returns it in US format.

So is there no Snitz function to decode the date strings properly?

New Photo Album Mod demo
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 27 October 2004 :  20:59:32  Show Profile  Send ruirib a Yahoo! Message
Snitz functions convert from date into str and str into date, str being the string date format in use by Snitz to record the dates of relevant forum events. That's all that has been needed so far.
I find it very strange that the StrToDate does not work properly. In every server this was tested, it worked correctly, AFAIK. Are you sure the regional settings of the server are set to UK?


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 27 October 2004 :  23:56:09  Show Profile  Visit Gremlin's Homepage
There isn't perhaps an Session.LCID over-riding it and causing a problem somewhere?

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

Ric
Starting Member

United Kingdom
47 Posts

Posted - 28 October 2004 :  08:01:21  Show Profile
Ruirib, I'm 200% sure the server is correct! I set the server up that I have at home myself and I even double checked it before posting here in case I'd had a spaz moment. The live webserver exhibits the same problem too.

I did check how Snitz stored dates when I started doing the mod so I could use the same convention. After I'd done the routine to create the date string, I found the StrToDate function and so used that for decoding them as it looked like it should sort out an UK/US issues by itself.

The actual Snitz forum itself works fine (both in development and live environments), it's only on my Photo Album mod that it comes out wrong. I'm 99.9999% sure I have the format of the date srting correct (see my 1st post) so I can only assume either StrToDate is not the function I need to use, or I need to apply another function after converting from a string.

Gremlin... a what?? All I'm doing is a StrToDate on a string value retrived from a table and then response.write'ing the result. Something along the lines of:

strDate=rs("PostedDate") 'retrieve date from recordset e.g. 20041027135734
strPostedDate=StrToDate(strDate) 'Convert it to date format 27/10/04 13:57:34
response.write "Posted - " & strPostDate 

This should give an output of "Posted - 27/10/04 13:57:34", but I get "Posted - 10/27/04 13:57:34".

New Photo Album Mod demo
Go to Top of Page

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 28 October 2004 :  08:56:51  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
Use the function chkDate(fDate,separator,fTime) (the function can be found in inc_func_common.asp, lines 580-644), it's used to display date/time in the format defined by Admin Options -> Server Date/Time Configuration -> Date Display.

Do a search in the Snitz files to see how it's used.

My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 28 October 2004 :  09:08:33  Show Profile  Send ruirib a Yahoo! Message
Ric, check your config.asp file for a Session.LCID statement, as Gremlin suggested. If there is one, make sure the LCID you're using is set to the correct value for the UK, which is 2057.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

Ric
Starting Member

United Kingdom
47 Posts

Posted - 28 October 2004 :  18:00:13  Show Profile
Thanks guys - both the last 2 things worked in one way or another!

My config.asp has:

Session.LCID = 1033 '## Do Not Edit

Hence, I have never edited it!!! (not that I even knew what it did... ) I changed it to 2057 and hey! The date comes out correct. But it struck me that this isn't ideal as it should really be controlled by the forum settings. I've already tried using chkDate a while ago and it didn't work, I got garbage out. But I just tried it again and obviously fed it the right data this time and it works too! I think last time I tried feeding chkDate with a StrToDate version of the date.

So, chkDate is the function I needed! But I'm now asking myself, what use is StrToDate if it ignores the forum settings...? Also what is the purpose of the session.LCID over-riding the server settings and having a "do not edit" on it?

Anyhow, thanks for your help guys!

New Photo Album Mod demo
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 28 October 2004 :  20:03:47  Show Profile  Send ruirib a Yahoo! Message
A server can host applications in many languages, so it makes sense to control regional settings by user session, which is what Session.LCID does. The do not edit is, I think, something that was forgotten from an earlier Snitz version.

Also, StrToDate makes all sense, since it deals with dates as such, not dates as they will be shown.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.48 seconds. Powered By: Snitz Forums 2000 Version 3.4.07