Formatting Date Incorrect Code
I have two dynamic listboxes.One is a date and needs formatting.I am using DWMX and therefore used the format function within the dynamic listbox wizard.When I run the page the listbox without formatting is ok, but the date listbox returns the following:
Microsoft VBScript runtime error '800a000d'. Type Mismatch 'DoDateTime' /admincontacts.asp, line 189
Line 189 is the following:
<option value="<%=(rsAdmin.Fields.Item("Date_Added").Value)%>" <%If (Not isNull(DoDateTime((rsAdmin.Fields.Item("Date_Added").Value), 1, 4105))) Then If (CStr(rsAdmin.Fields.Item("Date_Added").Value) = CStr(DoDateTime((rsAdmin.Fields.Item("Date_Added").Value), 1, 4105))) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(rsAdmin.Fields.Item("Date_Added").Value)%></option>
View Replies
ADVERTISEMENT
my problem is the FormatDateTime function it is changing the date format to MM/dd/yyyy but we need dd/MM/yyyy. We already changed the settings for the administrator user. Access the regedit tool and change the format to dd/MM/yyy on all the users on the server but we are still getting the incorrect format.
First we got for every case the format switch. For example we ask for this FormatDateTime("01/10/2003",2) Octuber 1st, 2003 an the result was "10/01/2003" January 10th, 2003
for days lower than the 12th and even if we send FormatDateTime("31/10/2003", 2) we got "10/31/2003". The server is running Windows 2000 Advanced Server with IIS 5.0
After some changes this is what is happening know
FormatDateTime("01/10/2003", 2) -- > 10/01/2003
FormatDateTime("31/10/2003", 2) -- > 31/10/2003
View Replies
View Related
I am storing dates in a database. WHen i come to do sql queries on the dates access is interpreting them as US format (mm/dd/yyyy). When the date is stored in the db it is in the correct uk format (dd/mm/yyyy) but when asp passes the queries to access the date format changes if the day is above 13.
For example if the date being searched is 10/2/2006 (10th feb 2006) it is searching the database for 2nd October 2006. If the i pass is 13/02/2006 (13th feb 2006) it searches it correctly.
I have tried setting the session.lcid to 2057 but this makes no difference. I read somewhere that access automatically treates dates as US format and only tries another format if the us format doesnt make sense. Is there any way around this?
View Replies
View Related
I have all of the dates I use in my tables stored as date in the YYYY/MM/DD format, with the columns set to DATE.
When I do any queries on the database (not usinf ASP) I get YYYY/MM/DD format returned.
When I do a recordset("datefield") ASP request I get D/M/YYYY returned. I have not asked anything to convert it, I have no idea where it is getting converted. It is a real pain, as I need to copy these dates through out the table, and they are getting returned in the wrong format.
View Replies
View Related
I know php has some nice color-code formatting, where it will show the file in nice colors
(highlight_source..)
An example of what I am talking about is located here:
http://dev.zaireweb.com/source.php?source.php
Is there a way to do this in ASP
View Replies
View Related
I was wondering if someone could help me with a formatting problem for ASP/SQL?
Is it possible to format a variable string from a textbox?
I'll try and make it more clear what i want, sorry.
I have a page with a textbox and submit button for users to input a postcode, which then searches a database for matching or similar postcodes.
This is the query i am using: Code:
View Replies
View Related
i have a date in the following format: 12/1/2003
how do i reference just the 'day' portion of this date - in other words '1'
if the date was 12/10/2003, then i would just want the '10'
View Replies
View Related
I am trying to display dates in a spreadsheet, but the dates need to be in a
format that will allow them to be sorted in Excel. The datatype in the SQL
Server database is datetime. In this case, I need to display the date only,
not the time. But I don't want to change the datatype in the database
because the time is used in other places.
So what I am doing is pulling it out of the database, then modifying it in
ASP/VBScript by using the datevalue function. This results in values such as
3/31/2006, 4/3/2006, and 4/14/2006. The problem is, the ones with the
single digit date (4/3/2006 in the sample data I just listed) messes up
Excel's sorting capabilities. How can I force the dates to display in a
2-digit date format? It would probably be good to do the same for the month.
View Replies
View Related
does anybody know if you can change the format of
a date from the us version 10/20/04 to the european way
20/10/04?
View Replies
View Related
I currently am showing Todays date on the page as follows:
<%=Date()%>
I would like to show it in Day of Week, Month, Date, Year which normally I would
show like this: <%=FormatDateTime(rstemp("StrDate"),1)%> where StrDate is a date/time field name.I want to do something like that with <%=Date()%>. Is there a way to do this?I am also using this to show Tomrrow's date also:
<%=Date() + 1%>
Again, I also want to show the date the same way.
View Replies
View Related
I know I could write one, but is there a built-in VBScript/ASP function to take a date, which is in the format mm/dd/yyyy, and put it in a yymmdd format?
View Replies
View Related
I've got ASP to display the date in the format mm/dd/yy - i'm assuming thats the default value for date(). how to format that so it is in the form dd/mm/yy ? Or is ASP just returning the date format from however it is configured on the web server?
View Replies
View Related
how can I format date that always return in fixed width. for example..
if the date is 1st jan, 2003..
it should return 01/01/2003 not 1/1/2003.i need date format always in 10 characters.
View Replies
View Related
I have the following at the top of my page :
Session.LCID = 2057 'UK
which sets local date/currency settings to UK. But despite this, a date entered as "28/01/1999" and stored in Access as "28/01/1999" is displayed as "01/28/1999". I haven't a clue whats happening.
View Replies
View Related
I have a client that wants a time field to resolve to 7:00 PM rather
than 7:00:00 PM (wants the seconds gone). vbLongTime provides the
later but vbShortTime produces a 24 hour version or 19:00. Any
suggestions?
View Replies
View Related
How do I perform the VB : format(now,"yyyy-mm-dd") in vbscript. It seems not to like 'format' ..
View Replies
View Related
I'm formatting the time that I'm storing. I'm trying to use:
riTimeIn = FormatDateTime(("timein"),3)
The problem is, since i'm using an insert i'm not using any recordset, so the code will not work. It will work like this (riTimeIn = FormatDateTime(rsdata("timein"),3) with the recordset. Do I just create a recordset.? Or is there away to get it to work without it?
View Replies
View Related
I currently drag in a date stored as dd/mm/yy in my access database into a recordset and subsequently onto my asp page. What I want to do is format that string so that it returns to the html code dd.mm.yy - could somebody could help me out here?
View Replies
View Related
I have a question regarding the date format. I am using an Access database as the backend. In Access there are only two formats, short and long.
Is there anyway to display the long date but without the day of week spelt out? In other words, I want January 24, 2006 and NOT Tuesday, January 24, 2006.
View Replies
View Related
I have a field in my mysql database that is configured as 'DATETIME' and '0000-00-00 00:00', which i populate using the 'NOW() function, this returns a date in the format
2004-09-18 22:08:26
I would like to have this displayed in my web page as
Tuesday, 18th September 2004 at 10:08 pm (or something very similar)
How would I go about doing this?
View Replies
View Related
The dates stored in my database are in dd/mmm/yyyy format but when it displays on the browser, it changed to mm/dd/yyyy format. Does anyone know what had went wrong??
View Replies
View Related
I'm returning a date (5th Jan 2004) from Oracle using the
following query:
select TO_CHAR(invoice_date,'DD/MM/YYYY') from...
This should return my date in the UK format, and it
certainly appears to be doing just that in Toad. And it
also looks correct in my form as it shows as:
05/01/2004
However when I submit my form I am having to convert the
date to an Oracle format using this function: Code:
View Replies
View Related
I'm currently entering the date into my date field using the now()
function, which delivers this result: 2/2/2004 9:08:09 AM which is
fine for some cases.
However, when retreiving this result, sometimes I'd just like to pull
up the first part, such as the 2/2/2004 and cut out the rest. How do
I take this date output, and format it to show only what I want? I'm
writing all this in ASP.
View Replies
View Related
I am having a little bit of trouble converting some time/date formatting.
I am retreiving it from an existing database we have (MS SQL) with
"SELECT * from table"
It is in this format "01/02/2005 13:31:00"
e.g. "DD/MM/YYYY HH:MM:SS"
I need to convert this to the format to YYYY-MM-DD e.g "2005-02-08"
Any suggestions would be appreciated. Perhaps some sort of more advanced sql query, or ASP scripting.
View Replies
View Related
I would like to generate a custom date format for my ASP output ... i.e.: "5 Apr 06" instead of the "05 April 2006" that the British English 2057 LCID automatically gives me. In other words, I would like a 3 digit month and two digit year.
The code on my page reads as follows now ...
<%= DoDateTime((Recordset1.Fields.Item("StartDate").Value), 1, 2057) %>
View Replies
View Related
i am having with my classifieds ads site, i am using Access. I little info first: every ad that is posted automatically includes the date it was placed, and on the actual ad page it shows when the user posted the ad and when it will expire.
the script always displays all date formats as so: mm/dd/yy however after using the following code in my asp files: session.lcid = 2057 it formats all prevouis ads like this: dd/mm/yy and that is what i wanted. Now here comes to the problem after inserting the above code every new ad that is posted on the site still shows the mm/dd/yy (us format) and i do not understand why.
View Replies
View Related
how i can format a date/time field from an access db, so it displays the date followed by just the hours and minutes of the time and not the seconds. The information is stored in the db using Now() so it contains the date and the time. I want it to show dd/mm/yyyy hh:mm .
View Replies
View Related
Is there a quick way to format a string in this format yyyymmdd in ASP / vbscript? I want this format because I want to pass the formatted date to a SQL Store procedure for a query on searching for date. The type of input could be something like 611974 (aka 6th January 1974) or 2091980 (aka 20th September 1980).
View Replies
View Related
I'm passing the current date and time to a DATETIME coloumn in my database and it's so far proved very finicky about what format it will accept. It seems to want it like so:
yyyy-mm-dd hh:mm:ss
I'm not sure but I think it will only accept the '24 hour' time. (Military time; ie. 17:58:23) The following line of code works and the database will accept it:
Code:
Year(Date) & "-" & Month(Date) & "-" & Day(date) & " " & FormatDateTime(Time,4) & ":" & Second(Time)
But it seems like an awful waste of declarations. Can anyone suggest a sleeker way of getting the date & time formatted so the database will accept it? Or if you're familiar with the MySQL DATETIME type, let me know the best acceptable way to pass this info.
View Replies
View Related
I have a variable that represents a standard mm/dd/yyyy date , but i want to change it to just October 6
''''
datepart("m","d" , mydatevariable)
'''''
....doesnt work.
View Replies
View Related
I am pulling legislation information and expiry dates from an access database and posting to the web. The expiry dates in access are formatted as Month Day, Year (EG.. January 1, 2006) But when they are pulled from the database to the web, they come out as 01/01/06. I know that the format we have in access is simply a mask, however we require that format be carried through.
This is likely a simple solution, however I am new to ASP and can't seem to locate any information on this. I have searched the forum for related info on this but can't find anything that relates to my specific situation.
Here's the code we are using so far...
Code:
<%
Do While NOT Recordset.Eof 'i.e. carry on looping through while there are records
Response.write "<tr><td>"'open row and first cell
Response.write Recordset("Legislation")
Response.write "</td>"'close first cell
Response.write "<td>"'open second cell
Response.write Recordset("Repealed")
Response.write " "
Response.write Recordset("Expiry_Date")
Response.write "</td></tr>" 'close row
Recordset.MoveNext 'move on to the next record
Loop
%>
I have also found and implemented the following code:
Code:
dt=recordset("Expiry_date")
dt=Month(dt)&"/"&day(dt)&"/"&year(dt)
response.write(dt)
This lets me change the positions of the numbers, but I can't figure out how to make it display the full month name and full year.
View Replies
View Related
Here is my code:
Quote: <%=FormatDateTime(strDate, 1) %>
All I am getting is Saturday December 30, 1899. Why isnt it showing todays date?
View Replies
View Related
i was wondering if anyone could tell me how to run code once based on date. I have an application that i want to update a database based on the particular month. Any ideas?
View Replies
View Related