Add Hours And Minutes To The String?
Jun 2, 2010I have the date format string dd-mm-yy. how to add hours and minutes to the string (i.e 13-03-2010.21.03) ....
DateTime.Today.ToString("dd-mm-yy") ?
I have the date format string dd-mm-yy. how to add hours and minutes to the string (i.e 13-03-2010.21.03) ....
DateTime.Today.ToString("dd-mm-yy") ?
I have a textfield where they can enter a date, a hour drop down and a minute dropdown.
What I would like to do is after i get the values for each to create a DateObject which has all 3. i.e 12/02/2009 15:36
But then also how dismantle the Date Object to get back my 3 individual values
my output is 87:02 hours 87 minutes 2
using (SqlConnection conn = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("SELECT CONVERT(VARCHAR(10),InTime,108 ), CONVERT(VARCHAR(10),outTime,108 ) FROM aten WHERE Id = '" + txtid.Text + "' and date between '" +
[Code].....
In my webconfig i put
<system.web>
<sessionState timeout="60"/> doesn't work for me
Also i changed in IIS configration Manager as well from 20 minutes to 60 minutes, but still it expire after 20 minutes of no actiuvity.
I have been working on a .NET/C# form that contains two time fields that are built out of dropdowns. Time A is made up of two dropdowns for Hours and Minutes and Time B is made up of two drop downs for hours and minutes too. I need to compare the two in order to ensure that Time A is always greater than B. I could just use a CompareValidator to check the hours, that works BUT doesn't take into account the minutes. So lets assume the following scenarios:
A = 11:00 B = 12:15 is fine my validation accepts this as it should do
A = 11:15 B = 11:00 is accepted because the hours are equal but otherwise shouldn't pass as the minutes aren't validated
How would you ensure B is always equal to or greater than A where dropdowns are used? I would if I could change this but not permitted to do so.
I'm trying to calculate the yrs, months, days, hours, mins, seconds between two dates with sql server or c# (ive just used sql more).
I have some code below that I started, but I get some negative values for months, values over 31 for months, and there very well could be more issues. Honestly my math is not the greatest and Im just not sure how to fix it. I want the user to be able to enter their birthday and for it to calculate the yrs, months, days, hours, mins, and seconds they have been alive.
[Code]....
I would like to get the accurarte (days, minutes, months and years) differnce between two date time variables and not just who is greater.
Is there a better way to do it then run DateTime's methods (TotalDays, TotalHours, TotalMinutes. etc...) and do the calculation?
The bottom line is to display something like "a minute ago", "an hour ago", "Three weeks ago", etc...
How can i convert string time into 12 hours (AM,PM) time format? Like if input string will like "2320" than i want answer like "11:20 PM".
View 2 RepliesI want to redirect the user after 2 mins if there is inactivity for 2 mins. I am not using ASP.NEt membership. And I dont want to use Sessiontimeout for this. Session timeout will logout the user even if he is working on the system. My objective is like screensaver process.
If there is no action for the specified time, the screensaver runs. Similarly, I want to redirect the user to login page.
note that i have already handled it with the following javascript:
[Code]....
Here what my problem is,
the user is working on the site...ok.. he want to see someother site.he browse someother site and works on....or even he can do some other work in his system...but he is active in his system... What this script does is, it automatically logout the user and redirect him to login page. But it should not do while he is active...IT SHOULD REDIRECT IF HE IS NOT ACTIVE REALLY (Similar to Screensaver process)
Is it possible ?
I have a grid view which contains Hours as one of the columns.. now, i need to have a total hours in the footer (sum of hours for all rows).
View 2 RepliesHow would you calculate the hours?
Example:
05:00 15:00 = 10 hours
07:00 12:00 = 5 hours
12:15 to 14:30 = 2 hours 15 minutes.
I have a c# function for producing thumbnail images, these images are displayed on web-page i.e ASP.netSo how would i programtically call this back-end function let say everyday at 16:00 or at 3:00.
View 3 RepliesHow do I get the data during last 24 hours ?
View 5 Repliesi have 30 data. i want show 24 hours at 24 hours only a data.
View 11 RepliesI have a web service that sends up to 5000 emails to our customers.
It is called asynchronously from a web application and then chuggs away sending the emails. Generally it works okay. Yesterday, it kept stopping - sometimes after sending a small number (33 first time) and then it might send another couple of hundred - then 50 or so etc. This went on all day as I kept manually calling the web service.
The data (subject, body, fromaddress, replytoaddress etc) is all kept in the database - as are the recipients.
Here's the code that gets the data from the database.
// Create Instance of Connection and Command Object
SqlConnection myConnection = new SqlConnection(ConnectionString);
SqlCommand myCommand = new SqlCommand("CPEmailsToSend_List", myConnection);
// Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure;
myCommand.CommandTimeout = 1000;
[Code]....
So I have a dataset containing 3 sets of data - the subject, body etc., a list of attachments and a list of recipients. I then use the .net smtpClient like this:
Code:
//about to start sending emails - update the MessageSendStatus to inprogress
myCommand.CommandText = "CPEmailSendStatus_Update";
myCommand.Parameters.Clear();
myCommand.Parameters.Add("@CPEmailID", SqlDbType.Int).Value = CPEmailID;
myCommand.Parameters.Add("@SendStatus", SqlDbType.TinyInt).Value = 1;
[Code] ....
When the web service stopped (it kept stopping yesterday) - no errors were raised. I have a function on the page that checks the email address is valid before I try to send the email as I know the smtpClient does not like invalid email addresses. Normally, invalid email addresses are trapped and the loop continues and sends the next one etc. But, yesterday, it just stopped sending. No error messages - nothing.
So, I began to wonder if the Command object is timing out. With a lot of email addresses to send to (up to 5000) and half a dozen attachments - the web service can take a long time (hours) to send all the emails. So, is the fact that I am reusing the command object over and over again for different stored procedures the issue? (I do this a lot and have never had a problem before - I read somewhere that the CommandTimeout only counts the time network access is used).
I've been sending test emails all morning (but I can only send small batches as I have a limited number of email addresses I can send test emails to) and they have all worked okay ... but, yesterday, trying to send about 5000 emails took about 30 attempts.
I have weekly wise scheduled hours of each employee and no of days scheduled for each employee,now i need to calculate no of employees scheduled less than 24 hours,no of emp's scheduled b/w 24 and 48 hrs and emp's scheduled more than 48 hrs in percentage for fisrt week,second week,3rd week and 4th week.
Like this
SCheduled Hrs 8/1/2010 8/8/2010 8/15/2010 8/22/2010
Less tha 24 hrs 5% 5% 5% 5%
b/w 24 and 48 hrs 4% 5% 5% 5%
>48 91% 90% 90% 90%
I have a timespan ts that has mostly minutes and seconds and sometimes hours. I'd like to format a string that'll give these results depending on the data
3:30 (hours not displayed, showing only full minutes)
13:30
1:13:30 (shows only full hours instead of 01:13:30)
So far I have
string TimeSpanText = string.Format("{0:h\:mm\:ss}", MyTimeSpan);
but it's not working.
Schedule Hours for Using WebApp?
View 7 RepliesNot sure if this can be done with ASP.NET, even the concept what I am trying to do...
I have some customers who I would like to send thank you letter automatically who bought online products from our website this day. Ofcourse if a customers buys something, he/she gets the
receipt and an order detail by e-mail. BUT I would like to send to all of the customers an additional e-mail, at same time ( for example 4 PM) to all the customers automatically.
I HAVE the code to send email to a recipent, database which contains all the customers who bought product this day. This works if I open the webpage and for example click a button or other events happen.
Is is possible that at a certain time, the ASP page automatically invokes the method (function) and send automatic E-mails to all customers? Or is this handled by other ways?
Is there a way to show hour in the calendar control?
View 1 RepliesI open my website and it is ok, but if I wait for 1 or 2 hours and click one button. then the page error. However if you reopen it in the new browser window then it is ok again.
The error page is as the following:
Server Error in '/' Application.
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Source Error:
[Code]....
Stack Trace:
[Code]....
Version Information: Microsoft .NET Framework Version:2.0.50727.4016; ASP.NET Version:2.0.50727.4016
How to enforce logon hours validation
View 10 RepliesI deployed one webservice which calls function which going take more than 5 -6 hours. I am using this webservice on my asp.net page and I am calling this webservice asynchronously. So how should I increase webservice time out?
View 3 RepliesHow to Retrive records within last 24 hrs using Nhibernate.I want to retrieve the 10 records within last 24 hours.
How can i achieve this using Nhibernate.
I can get my records from my database between days with this query.
[Code]....
but i need filter data between hours..