If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Date/Time Access

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-04-04, 11:58
Gaz2k Gaz2k is offline
Registered User
 
Join Date: Aug 2004
Posts: 7
Date/Time Access

I am trying to insert the correct date format into an access database using ASP (SQL)

I have searched the topics on the forum but don't answer my question.

-----------------

I have set the Locale to Session.LCID = 2057 British Time/Date

I have used the SQL Statement

strSQL = strSQL & "'," & "#" & Now() & "#" & ")"

But it inserts the Date/Time in American format still.

How can I overcome this probelm?

Thanks in advance Gaz
Reply With Quote
  #2 (permalink)  
Old 08-04-04, 15:47
DCKunkle DCKunkle is offline
Registered User
 
Join Date: Feb 2004
Location: Chicago, IL
Posts: 1,312
I know more about Access than I do about ASP. Are you looking at the date in an Access table after it has been inserted? If so, Access stores date information the same way, there are a couple of things that affect the way it displays. One is the Format function, another is the Regional Settings of the OS (assuming it is Microsoft). You will probably need to use the Format function to get it to display the way you want. Ex.

Format(Now(),"dd/mm/yyy")
Reply With Quote
  #3 (permalink)  
Old 08-04-04, 19:10
Gaz2k Gaz2k is offline
Registered User
 
Join Date: Aug 2004
Posts: 7
That code did not work in ASP,

I tried a few work arounds but it still didn't work.

I managed to get around the problem as so,

strDate = Now()

strDate = Replace(strDate, " PM", "")
strDate = Replace(strDate, " AM", "")

The reason why it was not inserting the record was because Now() has PM or AM at the end the date.

I am having a strange problem now though,
the date is inserted into the record using

Session.LCID = 2057

British format,

And appears in the database in this format.

When I display the record the date appears in american format with PM/AM?

I inserted a record directly into the database and the format is correct?
But when viewing it, it does not show the PM/AM as the records that I inserted with the ASP/SQL does.

Swings and Roundabouts!
Reply With Quote
  #4 (permalink)  
Old 08-04-04, 20:23
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
The key problem is that you are dealing with three different user profiles when you are doing this stuff...

One is the profile of the SQL user, it has it's own data time format setting...

Another is the profile for the IUSR account...

The last is the profile for the default user.

I wish I had a really good answer that would solve all your problems but I honestly haven't been able to find one.

What I tend to do is rebuild my dates into whatever format I want using month, day and year functions....
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On