I would like a code sample for a function that takes a tDateTime and an integer as input and sets the system time using setlocaltime after advancing that tDateTime by (int) months. The time should stay the same.
pseudo code example
SetNewTime(NOW,2);
The issues I'm running into are rather frustrating. I cannot use incmonth or simila...
I am aware of the System.TimeZone class as well as the many uses of the DateTime.ToString() method. What I haven't been able to find is a way to convert a DateTime to a string that, in addition to the time and date info, contains the three-letter Time Zone abbreviation (in fact, much the same way StackOverflow's tooltips for relative ti...
Guys,
Does anyone know 1) how precise the vb6 Date date type is (by way of fractions of a second) and how to format it to show fractions of a second.
I'm revisiting vb6 after many years absence, and for the life of me can't remember.
The things I used to know . . .
Thanks
P.S. I considered putting a "memory-leak" tag on this, beca...
I want to use the DateTime.TryParse method to get the datetime value of a string into a Nullable. But when I try this:
DateTime? d;
bool success = DateTime.TryParse("some date text", out (DateTime)d);
the compiler tells me "'out' argument is not classified as a variable". Not sure what I need to do here. I've also tried:
out (Dat...
.NET throws an exception trying to parse a datetime string in this format:
Fri, 10 Oct 2008 00:05:51 CST
Convert.ToDateTime("Fri, 10 Oct 2008 00:05:51 CST") results in an exception:
The string was not recognized as a
valid DateTime. There is a unknown
word starting at index 26
Character 26 obviously being the start of "CST"
...
I'm looking for some succinct C# 3 code to generate a random date between Jan 1 1995 and the current date.
I'm thinking some solution that utilizes Enumerable.Range somehow may make this more succinct.
...
I am trying to write a stored procedure which selects columns from a table and adds 2 extra columns to the ResultSet. These 2 extra columns are the result of conversions on a field in the table which is a Datetime field.
The Datetime format field has the following format 'YYYY-MM-DD HH:MM:SS.S'
The 2 additional fields which should be i...
I want to just store the year in one of my models. At the moment I just have a database field called year of type date, but it seems to want to take a whole date (yyyy-mm-dd) rather than just a year.
What's the best way to store this? In a date field but using some way of just getting it to store the date bit (in which case, how?), or i...
What's a windows command line statement(s) I can use to get the current datetime in a format that I can put into a filename?
I want to have a .bat file that zips up a directory into an archive with the current date & time as part of the name, eg "Code_2008-10-14_2257.zip". Is there any easy way I can do this, independent of the regiona...
This case arises in a real-life situation where invalid data was in (and continuing to come into) an Oracle database which is extracted into a data processing system in Focus. Focus would choke and die on some rows with invalid time portions. The Oracle DBA would then go and copy the datetime into the affected column from a good column...
Are there any classes in the .NET framework I can use to throw an event if time has caught up with a specified DateTime object?
If there isn't, what are the best practices when checking this? Create a new thread constantly checking? A timer (heaven forbid ;) )?
...
Since I've started to use jQuery, I have been doing a lot more JavaScript development.
I have the need to parse different date formats and then to display them into another format.
Do you know of any good tool to do this?
Which one would you recommend?
...
I am trying to pass some Subsonic collections to a client via a web service. When I reference the web service the IDE complains with:
Cannot serialize member 'EndDate' of type System.Nullable`1[System.DateTime]. XmlAttribute/XmlText cannot be used to encode complex types.
Is there any way of serializing nullable complex types in a .ne...
By default the SQL Server comes with the Langauge set to "English (United States)", setting the date format to mm/dd/yy instead of the date format I want it in, which is Australian and has a date format such as dd/mm/yy.
Is there an option in the Server Management Studio / Configuration tools where I can set the locale of the SQL Server...
Assume a table with the following columns:
pri_id, item_id, comment, date
What I want to have is a SQL query that will delete any records, for a specific item_id that are older than a given date, BUT only as long as there are more than 15 rows for that item_id.
This will be used to purge out comment records older than 1 year for the i...
I would like to know many minutes between 2 dates?
Example : Now - tommorow at the exact time would return me 1440.
...
For example, I'm trying to convert 2008-09-26T01:51:42.000Z to 09/26/2008. What's the simplest way of accomplishing this?
...
How to represent the start and end times for one day?
Using October 23, 2008 as an example, is it start 2008-10-23 12:00:00 AM and end 2008-10-23 11:59:59 PM?
...
Obviously I could create a Calendar object with the date and use get(DAY) on it, but knowing Groovy, I would guess there is an easier, quicker way I just don't know about?
Answer
(date1..date2).size() == 1 //true if two dates are on same calendar day
...
I'm using SQL Server ADSI to import data from Active Directory and using the whenChanged field to control if I need to reimport the members of a group.
Problem is the date is being returned in GMT and I'm currently in BST.
So, did a member change at 9:50 this morning, the AD tools I have say 9:50, but the ADSI query returns 8:50. This...