datetime

C# datetime binding

Hello, I have a textbox I want to bind to DateTime property to an object : myTextBox.DataBindings.Add("Text",myObject,"DateTimeProperty") myTextBox.DataBindings["Text"].FormatString = "HH:mm"; myTextBox.DataBindings["Text"].FormattingEnabled = true; myTextBox.DataBindings["Text"].BindingComplete += delegate(object sender, B...

What does it mean to return the client?

What does it mean to "return the client?" My teacher asked in an assignment to write a method that will return the date and the client. Here is her exact wording: " You should also override the ToString method, to return the date and the client. (DateTime has a reasonable ToString method defined. Use it.) I found using "\t" (the tab s...

Displaying date/time in user's timezone - on client side

I have a web application that displays datetime stamps on every page, for example: December 12, 2009 6:00 pm I would like to dynamically detect the user's timezone and alter the display using JavaScript. So the New York user would see: December 12, 2009 6:00 pm While the California user would see: December 12, 2009 3:00 ...

DateTime binding default error message using Linq to SQL

Hi, i'm using Linq to SQL for my model with a custom validation layer. I cannot find the way to edit or change the default message: The value '29/34/1980' is not valid for BirthDate. BirthDate is of course my textbox. Any ideas? Thanks EDIT: this is the simple code i'm using: <%= Html.Label("Data di Nascita (GG/MM/AAAA)", "BirthD...

Calculate time interval between 2 dates on different rows.

Hello. I have login and logout events and i need to calculate time between them. I guess i could group each 2 rows (each two messages) and then do the calculation, but how would you do that? Example XML i need to query: <Log> <Message> <DateTime>2009-12-02 14:38:41</DateTime> <Priority>Local3.Info</Priority> <Source_Hos...

Time of day script

Hi all, I have a small script that depending on the time and day; I would like it to output different things: <?php $currenttime = ((date("H")+7). ":" .date("i")); if ($currenttime >= "16:30") { $tomorrow = mktime(0, 0, 0, date("m") , date("d")+2, date("Y")); $jsdate = (date("Y"). "-" .date("m"). "-" .(date("d")+1). ...

Calculate working hours between 2 dates in Postgresql

I am developing an algorithm with Postgres (PL/PgSQL), and I need to calculate the number of working hours between 2 dates, taking into account that weekends are not working and the rest of the days are counted only from 8am to 15pm. Examples: From Dec 3rd at 14pm to Dec 4th at 9am should count 2 hours. (3rd = 1, 4th = 1) From Dec 3rd...

Is this value a valid year C#

What's the best way to check if a string is a valid year using C#? I currently have a dropdown list that contains the values {'All','2009','2008'} etc, and I want to know whether the selection is one of the dates or the 'All' field. Currently I'm checking for bool isYearValid = (Year.ToLower() == "all") ? false : true; How do I check ...

How can I get file's modification date in DDMMYY format in Perl?

What's the best way to do it? EDIT: Originally the question was "How to do it without the DateTime module". I removed this restriction in order to make the question more general. ...

Compare two DATETIME only by date not time in SQL Server 2008

I have two tables (bank statement and client requests) where column [date] is type of DATETIME2(0). I have to compare two records only by theirs Date parts (day+month+year), discarding Time parts (hours+minutes+seconds). How can I dot that? I tried CAST and CONVERT but it didn't helped. Update: Marc_s's answer works DATEADD(dd, 0, D...

How to find out the next year?

Sorry for the title....In PHP I use the date('w',mydate) to get the week and then I got the week of the date.If user clik next week it increments the current week by one. For example date('w',2009-12-10 05:00:00) it returns week as 50.if i click next week button iincrement as 51 and display the dates.at the end of 53 eeks also it takes ...

How to check if string is a valid DateTime Format string in Delphi

I want user to be able to manually enter format of the datetime fields in the program. I have Tedit component. For example if user enters 'HH:nn', then this is a valid datetime format string and all datetime components should change format property to this, but if he enters 'asd', it is not. Is there a quick way to check this, without wr...

How do I loop through a date range?

I'm not even sure how to do this without using some horrible for loop/counter type solution. Here's the problem: I'm given two dates, a start date and an end date and on a specified interval I need to take some action. For example: for every date between 3/10/2009 on every third day until 3/26/2009 I need to create an entry in a List. ...

create a JSON DateTime string with .NET

For a strange reason that does not matter for this question I need to create a JSON compatible substring that represents a DateTime and that will be manually insterted into a larger JSON string that later will be parsed by .NET's DataContractJsonSerializer. I have come up with the following method: static readonly DataContractJsonSerial...

Validate date without using validators?

is there a way to see if a date is valid without using validators? I can't use validators in this instance and it's a long story that is too much to type but it has to do with nested controls not being able to be found in javascript. But before i insert a date i want to make sure it is valid right before the insert. any ideas? I'm usin...

Python fraction of seconds

What is the best way to handle portions of a second in Python? The datetime library is excellent, but as far as I can tell it cannot handle any unit less than a second. ...

time convert in javascript

How does one convert the following to seconds in JavaScript? mm:ss.sss ? What is the .sss? ...

Load a DateTime array into ListBox?

How can I save a Properties.Settings.Default.Array using DateTime format (with just the time)? ...

How to get delay of 30 sec in current time in php ?

Date("F d Y H:i:s") gives current time in php. How can I get delay of 30 secs and 1 min in current time using php, not sure but something like Date ("F d Y H:i:s-30") or Date("F d Y H:i-1:s") ? ...

Why do I get 31 Dec 1969 as my last modified filename using filemtime in php ?

I am newbie to php and so please do not mind me asking this question but am really getting confused as to why filemtime(filename.txt)gives me as 31 Dec 1969 as my last modified time ? ...