datetime

What's the difference between ISO 8601 and RFC 3339 Date Formats?

ISO 8601 and RFC 3339 seem to be two formats that are common the web. Should I use one over the other? Is one just an extension? Do I really need to care that bad? ...

date and time in delphi

hey, what do i have to write, if i want date&time which updates itself? Label3.Caption := TimeToStr(Time) this just shows me the time, when i opened the program, but i want a time, that updates to the form every second (--> like a normal clock does). ...

python time to age part 2, timezones

Following on from my previous question: http://stackoverflow.com/questions/508727/python-time-to-age I have now come across a problem regarding the timezone, turns out that its not always going to be "+0200". So when strptime tries to parse it as such, it throws up an exception. I thought about just chopping off the +0200 with [:-6] or...

Does this custom DateTime format break in other cultures?

When displaying my DateTime values, I want them to be formatted like so: "February 9, 2009 7:00 AM" I am using the following code, but am concerned that the date may display incorrectly in other cultures. Can anyone tell me if this is the case or not, and if it is how can I fix it? Date.ToString("MMMM dd, yyyy hh:mm tt"); Thanks! ...

Generate datetime (exp: 09.02.2009) to string date (exp:Monday)

hello my master! i try to learn or generate any codes to learn string day("26.02.2009") ---> give me "wednesday" i need static datefunction in C# . Forexample: datetime Str_day= Returnstringdate("09.02.2009"); ---->Str_day="Monday"; Returnstringdate("09.02.2009") { it must return Monday!!! } OR Returnstringdate("09.02.2009...

DateTime.Compare how to check if a date is less than 30 days old?

I'm trying to work out if an account expires in less than 30 days. Am I using DateTime Compare correctly? if (DateTime.Compare(expiryDate, now) < 30) { matchFound = true; } ...

MVC DateTime binding with incorrect date format

Asp.net-MVC now allows for implicit binding of DateTime objects. I have an action along the lines of public ActionResult DoSomething(DateTime startDate) { ... } This successfully converts a string from an ajax call into a DateTime. However, we use the date format dd/MM/yyyy; MVC is converting to MM/dd/yyyy. For example, submitting a...

How to convert java.util.date to java.sql.date?

I am trying to use java.util.Date as input and then creating a query with it - so I need java.sql.Date. I was surprised to find that it couldn't do the conversion implicitly or explicitly - but I don't even know how I would do this, as the Java API is still fairly new to me. Any suggestions? It seems like this should be an easy feat...

How to do conditional SQL Server statements?

I have a database with event information, including date (in MMDDYYYY format). is it possible to write an SQL Server statement to only get rows that fall within a certain time frame? something like this pseudo-statement: SELECT * FROM events WHERE [current_date minus date <= 31] ORDER BY date ASC where date is the date in the SQL Ser...

How can I manipulate a Sybase datetime string in Perl?

Hey all I have a datetime field in a Sybase table, and need to use it in Perl for doing some calculations (differences to make sure I'm picking up the records that are at least 'n' mins apart). Now, if I simply do a select <datetime field>, Sybase returns a human readable field which is no use to me. I was looking at some way to convert...

Parsing datetime strings with microseconds

I have a text file with a lot of datetime strings in isoformat. The strings are similar to this: '2009-02-10 16:06:52.598800' These strings were generated using str(datetime_object). The problem is that, for some reason, str(datetime_object) generates a different format when the datetime object has microseconds set to zero and some str...

NHibernate: retrieve current database server DateTime

Hi, How could I get the current DateTime from the database server, using NHibernate? I tried to use the current_date expression, but it doesn't seem to work outside the where clause. What I need is something like SELECT getdate(). This query in SQL server gets de current datetime from the server, I just don't know how to put it in HQL d...

How do you iterate through every day of the year?

Given a start date of 1/1/2009 and an end date of 12/31/2009, how can I iterate through each date and retrieve a DateTime value using c#? Thanks! ...

String to time format but how?

I want to change a value from int or string format to datetime format. There is any function in SQL like the following?: Function: Result TimeAdd( nextrundate,"sec",45) 00:00:45 TimeAdd( nextrundate,"min",45) 00:45:00 TimeAdd( nextrundate,"hour",4) 04:00:00 But: TimeAdd( ne...

T-SQL to trim a datetime to the nearest date?

Duplicate of http://stackoverflow.com/questions/2775/whats-the-best-way-to-remove-the-time-portion-of-a-datetime-value-sql-server I have a column that tracks when things are created using a datetime, but I'd like to generate a report that groups then by day, so I need a way of nulling out the time component of a datetime column. How do...

Python format timedelta to string

Hi, I'm a python newbie (2 weeks) and I'm having trouble formatting a datetime.timedelta object. Here's what I'm trying to do. I have a list of objects and one of the members of the class of the object is a timedelta object that shows the duration of an event. I would like to display that duration in the format of hours:minutes. I ha...

Best way to store time (hh:mm) in a database.

I want to store times in a database table but only need to store the hours and minutes. I know I could just use DATETIME and ignore the other components of the date, but what's the best way to do this without storing more info than I actually need? ...

Want to display the current date/time

Hi I'm using php and sql through odbc to write a program and i hav got abit stuck in a part where i want to display the current date/time in the format date('Y-m-d H:i:s) but it only displays the gmt time. I want to add 8hours to it.Can any of you b able to help me.Thank you so much ...

Return day int value from function?

i try to write any code about days: function xyz("13.02.2009") { return value= 6; } function xyz("12.02.2009") { return value= 5; } function xyz("14.02.2009") { return value= 7; } but how? tihs method is good but i need C# times specific codes(like timespan...) DayOfWeek day = DateTime.ParseExact("13.02.20...

What is the best way to test that a c# DateTime is a minute, hour, month, etc

I need to test that a DateTime is at the beginning of a some unit of time for various units. This is the code I'm using right now: /// ignoring milliseconds all the way down bool IsMinute(DateTime dt) { return dt.Second == 0; } bool IsHour(DateTime dt) { return dt.Second == 0 && dt.Minute == 0; } bool IsDay(DateTime dt) { r...