Years, Months, Days, Hours, Seconds
Been playing with the function DateDiff, and with it it's easy to calculate the difference in years/months/days between two dates. However, if i wanted to calculate the difference in Years, Months, Days, Hours, Seconds (a la Ebay bids) how can I do this? Is it easy or complicated?
View Replies
ADVERTISEMENT
I have two dates, example would be 10/1/2006 and the current date 9/8/2007. How would I loop through and print out every month between these two dates with the year?
October 2006
November 2006
December 2006
January 2007
etc...
September 2007
View Replies
View Related
I'm completely stumped on how to write a loop for this.
I want to generate a dynamic list of links (years) and another of months based on the publish dates i have in my database. So if a month is not present the code would omit it.
View Replies
View Related
i'm importing a date ( 13/2/2005 1:20:22 PM) from SQL server
to informix.
The problem now is informix doesnt accept alphabet in datetime format,
so i plan to convert it before the date insert into informix db.
But the problem is i dont know any function that can convert the date time
from 12 hours format to 24 hours format.
View Replies
View Related
I'm trying to see all the records in the database older than 2 years from today, and I can't seem to be getting it to go.
SELECT * FROM comments WHERE (currentdate < 2002 - 07 - 20) ORDER BY
currentdate
I get null records returned, even though I can see some records as old as 1995. When I run the command like this however, it returns all the rows.
SELECT * FROM comments WHERE (currentdate > 2002 - 07 - 20) ORDER BY
currentdate
View Replies
View Related
i'm trying to count how many months there are between 2 dates... and the dates look like this
7/1/2004
8/1/2004
9/1/2004
10/1/2004
11/1/2004
12/1/2004
1/1/2005
2/1/2005
its 4 drop down box's looks like this
From: |Month drop down | |Year| To: | month drop down| |Year| ..
View Replies
View Related
I have an Access database that I'm using with ASPMaker to create the .ASP files. My records are basic daily reports dating back several years, with a "Date" field (mm/dd/yyyy) and then a couple of other fields.
I've set up a filter in ASPMaker to display only one month at a time instead of the whole list, or just 29/30/31 days. Code:
View Replies
View Related
Is it possible to select all twelve months in one select query either from a single field name or through an alias name?
I have a field name that conatins dates, and I would like to arrange the value of each month in a grid, jan-dec, monday-saturday. can I accomplish this with one select statement using an access db?
View Replies
View Related
I have this form where in i calculate the number of months
between 2 dates.It calculates only if both the textboxes have values.
And then i display this in another text box.
The user has to enter the date in DD/MM/YYYY format. user can select
date from calender popup. Apart from selecting the user can also type in
the date.
I am using a function which splits the date entered by the user
into DD MM YYYY and then compares each of these values to see
if its in the valid range like day is between 1-31, month between 1-12
etc.
But i m having a problem. If the user enters characters instead of digits,
my system accepts it in the first box without giving error and then when
the user selects a proper date in 2 textbox its gives an error: 1 is null
or not an object. this error comes at the place where mt function splits
the entire date string into DD MM YYYY.
Could someone please give ne a solution, a way to format the date so that
i let the user enter first 2 digits and then a "/" and then 2 digits and then a
"/" and then 4 digits only.
View Replies
View Related
I need to convert number into hours..Example: 12.60 should be 13 hrs,etc.
My variables
Total = oRs0("Tot") + oRs1("Tot1")
View Replies
View Related
I need to get average of the hours after (start_date - end_date). *start_date and end_date is in format 'mm/dd/yyyy hh:mi:ss am' . Is there any function in oracle that i can use so that i can directly get the average of the hours in SQL statement?
View Replies
View Related
How can I subtract hours from 'Now()'?
I can subtract a day, but that's by only having ONE integer...what do I do for hours? (i need this because our server uses EST and clients need their TimeZone)
View Replies
View Related
how you convert an integer such as 5 into an hour string so the system identifies it as an hour instead of just the number 5 and then once you do that ("if you need to do that at all") add 5 hours to the current time...
Also is there a way way to add lets say 50 hours to our current time and date so when it is calculated it shows 2 days and 2 hours away from now... If you cant do that it would be nice to know how to change 7.85 into just 7... or 8.94 into just 8... no rounding up or down just the first number before the decimal.
View Replies
View Related
I am using a select sum(tot_daily) as total hours ...it calculates the time incorretly...
Example:
ID | Tot_hrs | Person
----------------------
1 5.45 A
2 5.45 A
3 5.45 A
The total hours should be 17 hours 15 mins...but the result comes as 16.35.... Is there a way to calculate it as 17.15 in db level in a select statement
View Replies
View Related
How would I write in SQL or ASP the following?:
Count number of Database Records between NOW and 24 HOURS EARLIER? I know
how to retrieve recordsets etc - its just the date thing I cant grasp. I am
stuck getting the 24 hours earlier data capture.
View Replies
View Related
I have a request from the boss to make a report that will require me to display how many hours something has been in a particular state. (As in status). Hard to explain. Anyway, I need to go to the table in the db, find all rows for a particular trouble ticket, find when they were put into one of our 7 statuses, when they were put into another status (this info is already in those rows), then determine how many hours they spent there in
each status.
So a ticket report will say that ticket 1000 spent 4 hours in customer research, 5 hrs in our company coding. 3 in our company testing, 4 in customer testing, etc.
The thing is, It has to assume an 8-5 workday, and leave out any hours which don't fall in between 8 am to 5 pm, and also rule out any weekends.
View Replies
View Related
i need to get the number of seconds since Jan 1, 1990 or 70 or something to compare session times ... how do i get the timestamp in seconds ...
btw the msdn library is not a very good one ... does any one know an asp manual simillar to php (downloadble) ...
View Replies
View Related
Code:
StartTime = FormatDateTime((rs("startdate")),3)
this returns
7/4/2006 1:00:00 AM
I need to trim the seconds off so it looks like this
7/4/2006 1:00 AM
View Replies
View Related
I have two Win2K machines. Both "appear" to have been set up identically.
They both reckon that they're using UK date format.
However, if I create the following ASP code:
<%
Response.Write Now
%>
One returns
16/01/2004 17:12:19
Which is what I want, whilst the other returns:
1/16/2004 5:15:21 PM
Here, the day and month have been transposed and the time appears in the 12 hour clock format.
View Replies
View Related
I just need to know the DateDiff function for what I need to do...
I will store the date of the database record in a variable called 'sDate' what now? (Also, the format is xx/xx/xx 2:4:56 PM/AM)
View Replies
View Related
I'm trying to write a script to countdown the number of hours and minutes until tomorrow. So far, this is what I have:
Code:
<%
response.write(dateDiff("h",now(),date+1)) & " hours and " & dateDiff("m",Time(),date+1) & " Minutes "
%>
The code above correctly displays the hours until tomorrow. but it's not displaying the minutes correctly. It's displaying the total minutes until tomorrow. If there at 4 hours left until tomorrow it's saying "4 Hours and 240 minutes."
I need it to display "4 hours and 0 minutes."
View Replies
View Related
Basically I have 2 times:
timea = (date here) 12:00:00 PM
timeb = now()
and what i want to do is compare the difference in seconds between the two.
But I'm struggling and the thought has crossed my mind that DateDiff only works with dates not times...
Code:
<%
Dim DateToCompareTo
DateToCompareTo = 4/10/2005 1:00:00 PM
%>
There are <%= DateDiff("s", Now(), DateToCompareTo) %> seconds left %>!
View Replies
View Related
I have a variable that returns a certain number of seconds. Is there a function that can format this into something more useful?
For example, if the variable returned is 32, then it would format it to say "32 seconds"
If the variable is 312, then it would return "5 minutes and 12 seconds"
If the variable was 7315 then it would return "2 hours, 1 minute, and 55 seconds"
And so on.
View Replies
View Related
Is there a way to response.redirect to a url within 5 seconds or something, so its not right away? I was thinking meta refresh, but everywhere I go online it says that meta refreshes are not a good idea.
View Replies
View Related
I'm having a problem with this code:
Code:
<input type="hidden" name="lastdate" value="<%=now%>">
not returning the "seconds" portion of time. It writes the date and time - but only to the minute. The seconds are 00 each time. Ex. 1/29/2005 1:47:23 PM is what I want and 1/29/2005 1:47:00 PM is what I'm getting.This is the result I'm getting on two separate DB's on two different servers. I'm sure there's some glaring problem I'm overlooking because I sure can't see it.
View Replies
View Related
I have a column in my Access db that stores a number which is supposed to be seconds. How can I convert the seconds to display mm:ss on my ASP page? For instance, if the number in the db is 300, I want it to display 5:00 on my page.
Now these are lengths of time, not current time (AM or PM), so I dont want it to display the AM or PM. I've tried format(rs("length"), "nn:ss") and that didnt work. Matter of fact Format(), FormatDateTime(), and FormatNumber() doesnt work on my page. I've been getting the 800a000d Type Mismatch error. What am I doing wrong? Code:
View Replies
View Related
I'm trying to set up an asp script that redirects a user after a few seconds on a page- I cant use meta tags to redirect due to the page structure.does anyone have any similar scripts they could share?
View Replies
View Related
What is the best way to do an ASP/sleep for 8 seconds (pause script for 8 seconds)? I have tried the following:
EndTime = Now() + (8 / (24 * 60* 60)) '8 seconds
Do While Now() < EndTime
'Do nothing
Loop
But unfortunately that keeps the CPU at 100% for that time. I need something that doesn't impact the CPU, as this delay will be in a while loop that will execute continuously for a few days.
View Replies
View Related
I'd like to find the time difference in seconds in my ASP-code, but can't find how to do this. In php you have the time() that give the seconds from 1.1.1970 (?) until now. Is there something like this in ASP too? I have found the DateDiff that one just gives days, right? I basicly want to have two variables, time1 and time2, and show the seconds between them.
View Replies
View Related
I have a simple calendar scipt that ask for time of event input. While I like the time feature I do not like the fact that it displays with seconds included.
Ex. Displays HR:MIN:SEC 5:05:30 PM
Desired display 5:05 PM
How do I get rid of the display showing seconds? I have changed the database format, but this does not seem to effect the disply on the asp page.
View Replies
View Related
I need to convert seconds into time since for a message board application.
"minutes ago, hours ago and days ago" etc.
I have capture the time of the original post and compared it to the time now getting seconds but having a little trouble working out the seconds into time. Have used calculations (/60 minute), (/3600 hour), and (/86400 hour) but the time remaining is bugging me.
View Replies
View Related
Ive got some code on my site that shows how current the database is. Basically it looks at fixed text file that I am basing the database on, checks to see iwhen it was created, then displays the time.
My webserver must be on the East Coast and I am on the West Coast, so the time the stamped file time is 3 hours ahead. Code:
View Replies
View Related
The code to show how long it took the page to generate in seconds ?!?, if you get onto the main page of this site, www.tgplus.net and loom at the left had side, it tells you how long it took the page 2 generate.
View Replies
View Related