I use next code to print current time
Calendar cal = Calendar.getInstance();
System.out.println(cal.getTime());
I have Windows XP sp3 istalled. Current time in system tray is 14:30. But this code return 13:30
Why returned time is wrong?
...
DateTime.Now.AddMilliseconds(1.5); // adds 2 milliseconds
What on earth were they thinking here? It strikes me as horrendously bad practice to create a method that takes a double if it doesn't handle fractional values. Why didn't they implement this with a call to AddTicks and handle the fraction properly? Or at least take an int, so i...
When I try to put a value into a DATE field which is invalid, MySQL seems to use 0000-00-00 instead. Is there a way I can do this "check" without updating a DATE field? And to do it from for example PHP?
Like, is there a way I can query the MySQL server and ask "Hey, is this DATE, TIME or DATETIME valid to you?"
Or is there maybe an ev...
public static string TimeLine2(this HtmlHelper helper, string myString2)
{
StringBuilder myString3 = new StringBuilder();
DateTime start = new DateTime(2010, 1, 1);
DateTime end = new DateTime(2011, 12, 12);
myString3.Append("<table>");
myString3.Append("<tr>");
for (DateTime date = start; date <= end;...
I have an Oracle Date type to which I need to insert the current date.
I am using Java to generate this date but everything I've tried so far yeilds the following error:
java.sql.SQLException: ORA-01843: not a valid month
Can anyone suggest java code to generate a proper date?
Update:
The dates in the DB look like 11-DEC-06
SO, I'...
Hi,
i am using a large xml file having in the following format:
<Sales>
<Sale>
<Date>04/20/2010</Date>
<Time>18:17:29</Time>
<Id>P00000001</Id>
<Name>Prod Name</Name>
<Description>Prod Desc</Description>
<Category>Prod Category</Category>
<Subcategory>Prod Subcategory</Subcategory>
<Size>Prod Size</Si...
I'm working with an existing database where all dates are stored as integers in the following format: yyyy[3 digit day of year].
For example:
2010-01-01 == 2010001
2010-12-31 == 2010365
I'm using the following SQL to convert to a datetime:
DATEADD(d,
CAST(SUBSTRING(
CAST(NEW_BIZ_OBS_DATE AS VARCHAR), 5, LEN(NEW_BIZ...
Hello All:
I have an issue while converting "March 16-17" to DateTime and saving it to SQL server. "March 16-17" as it looks, read as March 16 to March 17, which in my case is invalid, but C# DateTime.TryParse() is treating "March 16 -17" as March 16, 2017 which is wrong, and saving the data in SQL server. SQL server treats "March 16-17...
I know that when I use DateTime.Now.Ticks in C# it returns a long value but I need to store it in an int variable and I am confused as to whether or not I can maintain that precision. As of right now I just have a cast
int timeStampValue = (int)DateTime.Now.Ticks;
This is a project constraint so I understand there is tons of precisio...
In Ruby/Rails, how do I convert a UTC DateTime to another time zone?
...
Hi,
In order to Unit-Test a feature, I need to fake DateTime.Now. Something like:
SupposeNowIs(new DateTime(..));
I can either use a third library that does it, or write my own little class.
What do you recommand? Do you know any good library for this purpose?
How would you fake time in C#? By changing DateTime.Now? (I suppose it's r...
How can I get UTC equivalents of Today_and_Now() and Today() call results?
Can I convert them back to local time?
...
How can I calculate time difference in JScript between two times in milliseconds or seconds?
For example, between 2010-04-23 15:03 and 2010-05-30 00:41
...
I have recently updated my system to record date/times as UTC as previously they were storing as local time.
I now need to convert all the local stored date/times to UTC. I was wondering if there is any built in function, similar to .NET's ConvertTime method?
I am trying to avoid having to write a utility app to do this for me.
Any su...
My database has a datetime field, and I want to be able to create new entries. Obviously the Rails datetime_select helper isn't the most user friendly thing to have in your form.
I'd rather have a text field for the datetime (or one for the date, and one for the time) and interpret the inputs like PHP strtotime can.
I might just be sea...
I want to compare two results
one is stored in the first query, and the other is exactly the same as the first, but i want only to recieve data < today
"SELECT s.GSP_nom as nom, timestamp, COUNT(s.GSP_nom) as nb_votes, AVG(v.vote+v.prix+v.serviceClient+v.interface+v.interface+v.services)/6 as moy
FROM votes_serveur AS v
INNER...
Hi I am trying to make a simple search form that uses a startTime and endTime to specify a time range. The db has a datetime field time that is compared against.
So far when i try to use params[:startTime] in the controller I get an array of values which wont work with :conditions => ['time < ?', params[:endTime]]
Is there a simple sol...
I'm familiar with printing time difference in milliseconds:
long time = System.currentTimeMillis();
//do something that takes some time...
long completedIn = System.currentTimeMillis() - time;
But, is there a nice way print a complete time in a specified format (eg: HH:MM:SS) either using Apache Commons or even the dreaded platform...
I need to get the minimum DateTime value of a column in a DataTable. The DataTable is generated dynamically from a CSV file, therefore I don't know the name of that column until runtime. Here is code I've got that doesn't work...
private DateTime GetStartDateFromCSV(string inputFile, string date_attr)
{
EnumerableRowCollection<Data...
I have following data and using SQL Server 2005
UserID UserName LogTime LogDate
1 S 9:00 21/5/2010
1 S 10:00 21/5/2010
1 S 11:00 21/5/2010
1 S 12:00 21/5/2010
1 S 14:00 21/5/2010
1 S 17:00 21/5/2010
Need Output as:-
1 S 2...