ASP 12 Hour Time Formatting
I have a date/time variable type in a sql 2000 database.
Say I have 1/1/2006 1:15:00 PM stored in it. On my asp page, How can I format that to read 1:15 PM? Is there a time formatting function or something?
I have a date/time variable type in a sql 2000 database.
Say I have 1/1/2006 1:15:00 PM stored in it. On my asp page, How can I format that to read 1:15 PM? Is there a time formatting function or something?
I'm developing in ASP/VBScript using DreamweaberMX, w/ an Access 2000 DB as the
data source. The source of the data is coming from a third party, which I get as
a CSV and import into the database, updating it weekly.
Since I have no control over how the data is collected, I'm not sure how to fix
this problem, but here it is.
This is a database of movies and among the many fields I import is one for the
movie's length, expressed in HH:MM:SS. This comes into the Access DB as a
Date/Time format, which means all the dates, displayed raw in the DB, look like
"12:09:52 AM". Through data formatting, however, displaying it to the client as
HH:MM:SS is no problem. (Display "12:36:00 AM" as military time (00:36:00) tells
me the movie is 0 hrs, 36 minutes, 0 seconds long. Follow?)
But in an update form, which we'll use to correct errors (and there always seem
to be errors in the running times of movies), I can't figure out how to display
it in the HH:MM:SS format in an INPUT field and have it submit without throwing
a data type mismatch error. It seems to want to display as "12:36:00 AM"
Converting the field to a text type is out of the question at this point, so I
know I need to do some type of string manipulation prior to update. However, I'm
lost ...
Any ideas?
I am having users select the time an event occurred by using 3 select menus. 1 for hour, 1 for minute, and 1 for AM/PM. Now I want to combine all three of these values so that I can store them in my Access Database. Currently the values are stored in 3 variables:
notify_hour, notify_minute, notify_am_or_pm
How would I concatenate or combine these variables to create a single time that I can use.
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.
I have a datetime field that looks like 7/24/2004 8:45:00 AM
I just want to display 8:45 AM
<%= FormatDateTime(Now, 3 )%> returns: 8:45:00 AM
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 RelatedI'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.
I've got a date/time field in the format "9/2/2007 8:00:00 PM" that I'm pulling from my db as part of a query.
My problem is every once in a while I get a time that is 00:00:00 AM (right at midnight) and then my results display only the date with the time blank because it was all 0's. Is there a way I can force it to show the time even when its midnight?
How do I convert the VBScript function hour() to return 1-12 instead of 0-23
View Replies View RelatedI am trying to make a form show at a specific time everday on my webpage. I am inserting the numbers of the the time in a database and posting it to the page. For some reason this is not working for me. Code:
View Replies View Relatedi have a VB Script that will export a certain files from a directory, and this script will run twice a day, once in the morning and once in the afternoon, but am having trouble getting it to work, my code looks like this: PHP Code:
View Replies View RelatedOne of my client is requiring that a section of his website to be restraint. It is currently in ASP. The visitor will be attributed an access code. This access code will be alpha numeric and contain 6 digits.
When my user will be entering this digit he will be allowed one hour access to the website. I guess the best way to do this is thru cookies. Any experience on this ?
how to do the count down timer? which their is count down timer for sepacific day, hour, minute and second.
View Replies View RelatedI would like to display the difference between the logging time
[Session("start"] and the current time [now]. In hours minutes and seconds,
I have tried a couple of things but all I see is gobbledy gook.
I have a website that I subscribe to that allows me to track tasks. I have an extra computer with a big monitor that i want to always display the task list. the problem is after so many hours I get logged out.
I need to need to reload that sign in url every few hours Code:
there i was just windering how do i compare a date/time vlaue in sql server agaisnt the computers' date/time.
for example, if computer date/time is two months or 2 weeks before the database date/time do something
Currently working on a ASP for a friend, which requires the date and
time on it. It pulls in entries from an Access Database with dates and
times in the format of:
"Fri Oct 17 18:02:46 2003"
However my date and time on the ASP page is displayed as:
"Friday, October 17, 2003 18:02:46"
using the script:
"<%Session.LCID = 1033%>
<%=FormatDateTime(Date(), vbLongDate)%>
<%Session.LCID = 2057%>
<%=time()%>"
Anyone know how to change this script, fully or partly to produce the
date and time on the format that's in the access database i.e. "Fri Oct 17
18:02:46 2003" Code:
I am working on a database that collects information about incidents. One of the fields that people enter is the time of the incident. I am trying to convert that string that people enter into a OdbcType.Time and I am at a lost.
View Replies View RelatedHow will we convert the system date & time to other timezone for eg: Eastern Time zone using ASP?
View Replies View RelatedWhen the Form is submitted I use the Date() and Time() functions to put the date and time into the Body part of the e-mail. The time reported is three hours earlier than the time at which the Form is actually submitted.
I understand these functions are evaluated on the server so the server must be in a time zone three hours earlier than where I am . Is there any way I can get the local time at the location where the user is actually located. ?
Any some tools or sample codes drop down asp script execute time and
database connection time ?
I'm trying to do a very simple code that converts the server time into a time zone of your choice.
<%
dim h 'Current Hour
dim i ' Time Zone Increase - add or subtract hours
dim r 'Result Here
h = Hour(Now)
i = + 2
r = h + i
%>
but obvisouly i'm having trouble with the time zone convert.
I am trying to compare the NOW time with a "deadline" time. Please help. Just not sure why this is not working. I need to be able to say IF IT'S BEFORE 9:30 TODAY, IT'S OKAY TO ADD SOMETHING. IF IT'S AFTER 9:30 TODAY, YOU MUST ADD IT TOMORROW.
CODE:
nowtime=now()
deadlinetime=formatdatetime(now(),2) + " 8:30:00 AM"
response.write "NOW: " & nowtime & "<BR>"
response.write "Deadline: " & deadlinetime & "<BR>"
if nowtime<deadlinetime then response.write "can send out today" end if
if nowtime>deadlinetime then response.write "must send out tomorrow" end
if
RESULTS:
NOW: 1/18/2007 8:51:43 AM
Deadline: 1/18/2007 8:30:00 AM
can send out today
As you can see, NOW is GREATER THAN Deadline, so it should must send out tomorrow.
i want to calculate the total time between to dates and time.
Example: Total time elapsed from date 1 time 1 to date 2 time 2.
27/09/2004 11:00 - 28/09/2004 10:30
The user enters a record and then later comes back and closes it. I need to know the time it took from when they entered the record until the time it was closed.
I’m having an issue saving/reading an xml file.The source of this file is a the parameter of an object. Through the UI the user can change the value (xml string) of this parameter.
The problem is that the parameter needs the xml with > , < , and " instead of the > , < , " chars. However when I save it, the xml dom and even the fso save it with the actual xml chars. Other than a literal search, is there an easy way to convert the file to have the special chars?
Im looking for an online site that I can format or tidy ASP pages. If any one also knows of a software application that can format asp /html pages id be greatfull of that link too.
View Replies View RelatedI'm having users enter a message into a textarea, but I'm having problems with the formatting. How do I add " " characters where they have pressed enter?
This is being entered into a MySQL database, so I have already replaced the ' with '.
I am requesting a variable for the users' network username:
<%=Request.ServerVariables("LOGON_USER")%>
This returns the following:
NETWORKJ.Bloggs
Instead I would like it to return J.Bloggs on it's own with out the "NETWORK" bit so basically I am saying how do I cut out the first 8 characters of a variable.
I have users typing in information into a text box. Sometimes this information can be lengthy and contain simple formatting such as spacess between lines and line numbering. For example:
1. List item number one
2. List item number two
I then have a report page that prints out this information. Unfortunately, the line spacing doesn't show up in the report. It's just all jumbled together. I'm just using <%= Notes %> to show the db field. Is there a way that I can show the formatting that was originally entered or do I need to use some kind of word processor like I am using to type this post?
I would like to know how to format phone numbers and ssn numbers in textbox. That is when I enter the phone number, it is going to the database as 000,000,0000. I want to have it as either 0000000000 or 000-000-0000. Likewise, for ssn also. I am really fed up with javascript, somehow, it doesn't work well for me. Always, get page errors and it is not that easy to find out the errors in javascript.....
View Replies View Relatedi 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'
When e-mailing invoices and estimates, is there any way to customize the
presentation of the e-mail beyond changing the message? Specifically,
I'd like to add some html so the receiver can click on a link to pay
online. As it is, I can type the URL in the message, but it appears only
as text to the reader, not a hotlink, which, unfortunately, is quite
vexing to some of my clients.
It would also be nice to add a company logo, etc. to the email body.
On this same subject, is it possible to send the entire invoice/estimate
as HTML rather than an attached PDF? I haven't seen these options
anywhere.
I'm currently doing some work with ASP and XML DOM.
Is there any way when saving XML to get ASP to save it in a formatted way? Similar to PHP's formatOutput setting? At the moment my xml is being appended on line e.g
<test>1</test><test>2</test>
Is there a setting to get ASP to save XML like:
<test>1</test>
<test>2</test>
The XML document I'm working on is fairly large and its proving very difficult to read through the xml at the moment.