datetime

CompareValidator messes up validationgroups in Firefox (ASP.NET)

I used a CompareValidator like so: <asp:CompareValidator ID="cvtxtDOB" runat="server" Operator="DataTypeCheck" ControlToValidate="txtDOB" ErrorMessage="Invalid date format" Text="*" ValidationGroup="GeneralValidations" Type="Date"></asp:CompareValidator> If I enter a date using this format 31/01/10 (for 31 January 2010), Firefox throw...

Formula for calculating an Ephemeris table

Here's an obscure question: I need to be able to determine historical astrological periods (semi) accurately. I am looking for a way to calculate the start and end dates of a given zodiac sign period given a geographical coordinate and a year. The purpose of the algorithm is to determine the possible dates of birth for a person whose a...

Convert string to Date - C#

How would I be able to convert a string like "On Monday 25th March 2010..." to 25/03/10? Also, is this possible? ...

Parsing JSON data including date creates wrong Date object.

I make an ajax call with jQuery 1.4.2 with dataType: 'json'. $.ajax({ url: url_with_json_formated_response, data: jsonOptions, dataType: 'json', error: function(XMLHttpRequest, textStatus, errorThrown){ alert('unable to get data, error:' + textStatus); }, ...

javascript date and year

I have the following javascript code: <script type="text/javascript"> $(function () { var currentDateTime = new Date(); var oneYear = new Date(); oneYear.setYear(oneYear.getYear() + 1); alert(currentDateTime + "_" + oneYear); }); </script> i would expect the alert to output the current datetime ...

Group SQL results by week and specify "week-ending" day

I'm trying to select data grouped by week, which I have working, but I need to be able to specify a different day as the last day of the week. I think something needs to go near INTERVAL (6-weekday('datetime')) but not sure. This kind of SQL is above my pay-grade ($0) :P SELECT sum(`value`) AS `sum`, DATE(adddate(`datetime`, I...

Java equivalent of DateTime.MinValue, DateTime.Today

Is there a Java equivalent of DateTime.MinValue and DateTime.Today in the Java Date class? Or a way of achieving something similar? I've realised how spoilt you are with the .NET datetime class, I also need the equivalent of AddDays(), AddMonths(). ...

Convert dd-M-yyyy to mySQL datetime

I have a MySQL varchar column full with dates stored in dd-M-yyyy format. E.g: Row 1: 12-jan-2010 Row 2: 23-jun-2016 What's the best way to convert this to mySQL datetime format using php? ...

Changing the first day of week in rails

I and trying to build a calendar in ruby on rails. In ruby-on-rails, monday is considered to be the first day of the week, but i have to set sunday as the first. I intend to change this to properly use the date's built-in methods RoR. Assuming today is sunday, oct 24th. Look the example: Date.now.beginning_of_week it prints: 2010-10-...

DateTime interval restriction in C#

The problem: I am in process of implementing a scheduler for my advisor in school. The scheduler supposes to setup a 15 minutes interval time slot from 8:00 AM to 5:00 PM, Monday to Friday. In addition, the advisor will have to specify the start and end dates of the scheduler. The scheduler will also feature an option to specify if the 1...

How to convert TEXT data to DATE TIME in SQLITE in Android?

Hi! I am new to android. I am using a database to store my data. I also store date as TEXT in database. format of date is as follow... "Mon, 20 Oct 2010 12:30:00" So i stored them in TEXT datatype not in DateTime. Now i want to display them in following format "Mon, 20 Oct 2010" The main thing is that i want to ORDER them in DESC. I w...

Parse ONLY a time string with DateJS

I'm using the excellent (but large) DateJS library to handle dates and times in my webapp. I just came across something that I'm not sure how to handle. I want my users to be able to enter Time strings only, without a date, but they should be able to enter it in any manner they please. For instance: 5:00 pm 17:00 5:00pm 5:00p 5p etc. ...

Is there a more efficient way to get the previous Monday for a given date in C#

So I have an application that needs to get a date focus so it can run appropriately. Given a particular date to focus on it needs to know what week it is in. I'm calculating weeks based on Monday dates. And I'm wondering if my focus on Mondays is excessive. public static DateTime PreviousMonday(this DateTime dt) { var dateDayOfWeek ...

Simple date computation in C#

Hi experts, do you happen to have a sample code on how to subtract day tomorrow or 2 days from today? And then I will multiply it by a number depending on its reserved value. I am figuring how to operate a hotel checking in and show its price by asking when the customer checks out, so the price will be ready upon checking in ...

How to use java.sql.Timestamp as real java.util.Date with JPA

I have a problem about the management of dates with milliseconds. I understand the need to use the TIMESTAMP to store milliseconds: @Temporal(TIMESTAMP) @Column(name="DATE_COLUMN", nullable = false) @Override public java.util.Date getDate() { return this.date; } But if I can't compare this date to another instance of java.util.Date, u...

The result of [Datetime + 420./1440] (7 hours) is wrong (precision in ms is lost)

Could pls explain why I' not able to get valid result ( with precision to miliseconds ) after doing this (adding 7hrs to date): select getdate() as dt into #t1 select dt, dt+(7.*60/1440) as dt_new from #t1 I got: dt dt_new 2010-10-25 04:56:33.640 2010-10-25 11:56:33.580 As you can see there is difference in 60m...

How do DateTime.ToBinary() and DateTime.ToFileTime() differ?

Can anyone help explain the difference between DateTime.ToBinary() and DateTime.ToFileTime()? As far as I can tell they seem to always return the same value (when dealing with UTC times at least). The same applies to DateTime.FromBinary() and DateTime.FromFileTime(). I've tried using Reflector and I can see some differences, I just don'...

How to display dynamically the previous month name.

I want to display the previous month name. My code is given below but it displays the index of that month. I want the name of that month. According to this given code it dipslays the tool tip as "Balance up to 9", but I want to display "Balance up to September". How get the name of that month? lblPreviousBalance.ToolTip = "Balance up t...

How to get difference of saved time and current time in jquery?

I want to get the time difference between saved time and current time in javascript or jquery. My saved time looks like Sun Oct 24 15:55:56 GMT+05:30 2010. The date format code in java looks like String newDate = "2010/10/24 15:55:56"; DateFormat format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = format.parse(newDate); ...

C# get time in milliseconds

I'm making a program in which I need to get the time in milliseconds. By time, I mean a number that is never equal to itself, and is always 1000 numbers bigger than it was a second ago. I've tried converting DateTime.Now to a TimeSpan and getting the TotalMilliseconds from that... but I've heard it isn't perfectly accurate. Is there an ...