FormatDateTime

I have a simple four line bit of code in a page on my web site that gets today's date, formats it (FormatDateTime(thedate,2), and compares it to a date drawn from a database which is formatted the same way, and then if the two match, writes a message on the page.

Dates in this format work just fine:
Jun 09 1975 12:00AM

However, most dates in the database are in this format:

Monday, June 09, 1975 12:00:00 AM
and I get Data Type Mismatch errors from those when it tries to format the date. Evidently, it doesn't think this is a valid date format. In the database (SQL Server), the field is set up as datetime, so I wouldn't think there'd be a problem. I'm just missing something small, I think, but I'm not sure what it is.

View Replies


ADVERTISEMENT

FormatDateTime

I have a field in my database that records the date/time of various events in the usual format of dd/mm/yyyy/. I need to display this field on my asp page in a string format.

Is there another function out there that does the opposite of the cdate function?

I have tried using the FormatDateTime to convert, but without any luck?


Code:

Response.Write("<br /> " & FormatDateTime(Date, 1)( objRS("END_DATE")))

View Replies View Related

FormatDateTime

Is there any way to define the default date/time format, instead of having to format every single time you print a date/time?

View Replies View Related

FormatDateTime

I set my computer Regional Setting (Control Panel - Regional and Language Options - Customize - Date) to dd/mm/yy. In my ASP page I do the following:

FormatDateTime("1/20/07",2)

and it returns 1/20/07 instead of 20/1/07. I though my setting it to 2, it will display a date using the short date format specified in your computer's regional settings, how come it is not ? How can I set the string to display a date using the computer's
regional setting ? IIS is running on my machine, I am not on a network, it is just my
machine.

View Replies View Related

FormatDateTime

I set my computer Regional Setting (Control Panel - Regional and Language Options - Customize - Date) to dd/mm/yy. In my ASP page I do the following:

FormatDateTime("1/20/07",2)

and it returns 1/20/07 instead of 20/1/07. I though my setting it to 2, it will display a date using the short date format specified in your computer's regional settings, how come it is not ? How can I set the string to display a date using the computer's
regional setting ?

View Replies View Related

FormatDateTime

I get the error

Type mismatch: 'FormatDateTime'
When I use dtmTime = FormatDateTime(val,vbLongTime)

why? The date store in my database is 02/09/2004 11:27:28.

View Replies View Related

FormatDateTime

I'm using FormatDateTime(Now) on a form to include when the form was submitted. The problem is that my time zone is 1 hour ahead of the time zone in which my server is located. Is there an easy way to increase the hour by +1?

View Replies View Related

FormatDateTime Isn't Working

<%response.write(FormatDateTime(rs("Adate"),2)) %>

I am getting the following error:
Microsoft VBScript runtime error '800a0005'
Invalid procedure call or argument: 'FormatDateTime'

Please explain why I am not able to use the FormatDateTime function.

View Replies View Related

Converting Using Formatdatetime()

how to convert a date in (tuesday,may 17,2005) to a date in(17/05/2005) format. is it possibleto dowith the helpof formatdatetime() function. if possible how ?

View Replies View Related

Type Mismatch: 'FormatDateTime'

I am trying to extract the time out of a date/time but recieve the type mismatch error. The data is stored in an Oracle database as a Date/Time and I am able to extract it from the DB and display it on the screen OK, but when I try and format it like this:

Dim timeofpurchase
timeofpurchase = FormatDateTime(rscustomer("time_of_purchase"), 4)

I get an error. I have had a look at documentation on the web but all of the examples only show how to format the current date and time, not how to format a variable that contains a date.

My question is, how do I force my variable, rscustomer("time_of_purchase"), to be treated as a time?? or how do I declare the variable timeofpurchase to accept a date/time??

View Replies View Related

Firefox Problem With FormatDateTime()

I'm using an asp function FormatDateTime() in IE6 and it's working perfectly. When I try use it in Firefox it throws;

Microsoft VBScript runtime error '800a0005'

Invalid procedure call or argument: 'FormatDateTime'

/evacation_DEV/common/objects/calendar.asp, line 94

This line is;

objNewDay.DateString = FormatDateTime(DateSerial(mnYear, mnMonth, nDayIndex),2)

mnYear, mnMonth and nDayIndex are set to Integers. Has anyone any idea of how I can fix this?

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved