Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 25th, 2003, 03:52 PM
Registered User
 
Join Date: Nov 2003
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
 
Old November 26th, 2003, 03:15 AM
Friend of Wrox
 
Join Date: Jun 2003
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
 
Old November 26th, 2003, 05:58 AM
Registered User
 
Join Date: Nov 2003
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





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.