Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 25th, 2003, 03:52 PM
Registered User
 
Join Date: Nov 2003
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Save universal date format

Hi there.
I have a site where I want to view only the post that not have gone out of date. I have a input form where I can add this date, and this works perfect in my Norwegian server. I add the expires date in this format: 21.11.2003, and save it in my Access base. When I do my query I do this to select the post that not have reach this date:
WHERE ExpiresDate >= Date()
Now I want to make this code universal - so I can use the code in any server. I have heard that the best solutions is to set my date field in the database to integer, and use datadiff to get all the mins, secs and son on into the base. Is this correct?
If so - how do I save the form input 25.11.2003 in the base so it is saved in a universal format like this?
Let's say: Expires = Request. Form ("Expires"), but what now? How can I convert this and save it?
I this anything I should use, and if so - how can I use this to solve my problem?

<%
    timeStart = "1/1/1970 12:00:00 AM"
    Response.Write(datediff("s", timeStart, now()))
%>



SELECT DATEDIFF(SECOND, '1/1/1970 12:00:00 AM', GETDATE())

Regards
Einar Hansen, Norway
Reply With Quote
  #2 (permalink)  
Old November 26th, 2003, 03:15 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Sydney, NSW, Australia.
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The "best" way to do this is to:
a) set the LCID for the page to the appropriate locale for the user
b) allow the user to enter their date in their native format (eg mm/dd/yy or dd/mm/yy or dd.mm.yyyy or whatever)
c) format the date into yyyy/mm/dd and insert into the Access database

Some links that may be useful:
http://www.adopenstatic.com/faq/dateswithaccess.asp
http://support.microsoft.com/?id=229690

Cheers
Ken

Microsoft MVP - Windows Server (IIS)
www.adOpenStatic.com
Reply With Quote
  #3 (permalink)  
Old November 26th, 2003, 05:58 AM
Registered User
 
Join Date: Nov 2003
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

[quote]Originally posted by KenSchaefer
 The "best" way to do this is to:
a) set the LCID for the page to the appropriate locale for the user
b) allow the user to enter their date in their native format (eg mm/dd/yy or dd/mm/yy or dd.mm.yyyy or whatever)
c) format the date into yyyy/mm/dd and insert into the Access database

Some links that may be useful:
http://www.adopenstatic.com/faq/dateswithaccess.asp

Thanks for your tips. During the last year I've created a lot of functions that convert date format into ....well whatever :-)
So I was pretty familiar to you suggestion. Som friends have though suggested that I should use the datadiff method instead.
Well, I have no written my own function that convert the input to US format. And this works perfect at both the Norwegian and the US server :)
I have one question though. When I take a look at the date in my Access base the format is still Norwegian. But the saving and query is working well. Is this because the DB is Norwegian? And is it only the saving of date that have to be in US format?

Regards
Einar Hansen, Norway
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
date format differs, need to force format somehow patricolsson ASP.NET 2.0 Basics 1 December 3rd, 2009 12:53 AM
Convert British format date to American format? fyr PHP How-To 0 December 19th, 2007 03:17 PM
How to give Date format while entering date Subuana Beginning VB 6 4 March 17th, 2006 07:25 AM
date format differs, need to force format somehow patricolsson HTML Code Clinic 2 January 12th, 2006 05:55 AM
how to save text with format?? 6cet6 ASP.NET 1.0 and 1.1 Basics 4 November 20th, 2003 06:49 AM



All times are GMT -4. The time now is 12:05 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.