datetime

How do I get date form week, working also with 53-week years? c#

Hey, I have made a function to cound the weeks in a year, and that works fine. The problem is that I need a method to get the mondaydate of the week. This is a swedish calendar. The code below works well for years that have 52 weeks, but some years(like 2009) has 53 weeks. Then I got a date from januari as the mondaydate(cant be right)...

Joda-Time: DateTime, DateMidnight and LocalDate usage

Joda-Time library includes different datetime classes DateTime - Immutable replacement for JDK Calendar DateMidnight - Immutable class representing a date where the time is forced to midnight LocalDateTime - Immutable class representing a local date and time (no time zone) I'm wondering how are you using these classes in ...

MySQL: NOW() giving me zeros

I have a table which I want to record the timestamp of every order at every insertion time. However, I'm getting zero values for the timestamps. Here's my schema: CREATE TABLE IF NOT EXISTS orders( order_no VARCHAR(16) NOT NULL, volunteer_id VARCHAR(16) NOT NULL, date TIMESTAMP DEFAULT NOW(), ...

Get Time in London

How can I get the current local wall clock time (in number of millis since 1 Jan 1970) in London? Since my application can run on a server in any location, I think I need to use a TimeZone of "Europe/London". I also need to take Daylight Savings into account i.e. the application should add an hour during the "summer". I would prefer to ...

How do you convert date taken from a bash script to milliseconds in a Java program?

I am writing a piece of code in Java that needs to take a time sent from a bash script and parse the time to milliseconds. When I check the millisecond conversion on the date everything is correct except for the month I have sent which is January instead of March. Here is the variable I create in the bash script, which later in the scr...

Find the number of days in a month in Java

How do you find the number of days in a month in Java? ...

Comparing times/dates with the iphone SDK

Hi all, I am new to the whole iPhone SDK and objective C, but have managed to get three times, two pulled from RSS feed, and one from the iphone. I currently have: sunrise, sunset and current time set like: 6:51 am //Sunrise 7:36 pm //Sunset 11:34 AM //Current time I am trying to work out the best approach to find out if ...

MySql difference between two timestamps in days?

How can I get the difference between two timestamps in days? Should I be using a datetime column for this? I switched my column to datetime. Simple subtraction doesn't seem to give me a result in days. mysql> SELECT NOW(), last_confirmation_attempt, NOW() - last_confirmation_attempt AS diff FROM DateClubs HAVING diff IS NOT NULL ; +-...

VBScript Work out if a person is over 18 based on their Date of Birth

Hi all, I have my users DOB as a string (don't ask), how can I reliably check to see if they are over 18? Would I use DateDiff? How would I convert the string to a date first? The date is in dd/mm/yyyy format. Many thanks Jonathan ...

Problem with oracle stored procedure - parameters

I have this stored procedure: CREATE OR REPLACE PROCEDURE "LIQUIDACION_OBTENER" ( p_Cuenta IN NUMBER, p_Fecha IN DATE, p_Detalle OUT LIQUIDACION.FILADETALLE%TYPE ) IS BEGIN SELECT FILADETALLE INTO p_Detalle FROM Liquidacion WHERE (FILACUENTA = p_Cuenta) AND (FILAFECHA = p_Fecha); END; / ...and my c# code: ...

Convert UTC DateTime to another Time Zone

I have a UTC DateTime value coming from a database record. I also have a user-specified time zone (an instance of TimeZoneInfo). How do I convert that UTC DateTime to the user's local time zone? Also, how do I determine if the user-specified time zone is currently observing DST? I'm using .NET 3.5. Thanks, Mark ...

XmlSerializer.Deserialize method appends timezone to a time and datetime field

Have a small script in Microsoft.NET 2.0 that deserializes a XML back to a typed object, connects dyanimcally to a web service using ServiceDescription and binds the deserialized typed object to the WebMethod inbound. The XML prior to serialization looks like below <completion_time>12:19:38</completion_time> on the wire when communic...

Show elapsed time since pressing a button in Android

Hi, I want to be able to show the elapsed time in a textview or Chronometer held in a "Statistics" class since pressing a button located in another class. What would be the easiest way to implement this?. Thanks ...

Date/Time formatting in .NET (Devexpress Gantt charts to show time rather than date)

I have some data about a day's events that I'm trying to visualise as a Gantt chart using Devexpress XtraCharts. Devexpress's example here shows the chart being populated by date. However, I'd like it to be populated by time to compare the events throughout one day. My X-axis is displaying correctly - done like so: ganttDiagram.AxisY.D...

Web service for Timezone based on Location

Hi, Is there any web service available that returns the information of Time zone based on the location name entered. I am preparing the application where in user will enter the place, based on the place entered, I need the information of the timezone (preferably current time and date) of that particular location. Kindly help me. Rega...

In Python, how would I do this Datetime?

right_now = datetime.datetime.now() one_hour_before = ????? How can I use right_now to get one_hour_before? ...

MS-Access 2007 Time Online Report

I have the following data in my database: MemberID | DateTime ------------------------------------- 1 | 31/03/2010 3:45:49 PM 2 | 31/03/2010 3:55:29 PM 1 | 31/03/2010 4:45:49 PM Every time a user is authenticated or un-authenticated this log appears in the database. What I want to be able to do is total th...

Why does the month argument range from 0 to 11 in JavaScript's Date constructor?

When initializing a new Date object in JavaScript using the below call, I found out that the month argument counts starting from zero. new Date(2010, 3, 1); // that's the 1st April 2010! Why does the month argument start from 0? On the other hand, the day of the month argument (last one) is a number from 1 to 31. Are there good reaso...

Using .net Datetime in sql query

I have a DateTime object I want to compare against an sql datetime field in a where clause. I'm currently using: "where (convert( dateTime, '" & datetimeVariable.ToString & "',103) <= DatetimeField)" But I believe datetimeVariable.ToString will return a different value depending on the culture where the system is running. How would ...

How do I retrieve 10 days data up to date 'XYZ' from mysql with Perl when some days data are missing, i.e. public holidays.

Data is put into a MYSQL DB in the following format: | 2010-03-18 | 1.580 | 1.590 | 1.560 | 1.580 | 164500 | 1.580 | | 2010-03-19 | 1.570 | 1.570 | 1.560 | 1.570 | 178300 | 1.570 | | 2010-03-22 | 1.550 | 1.560 | 1.540 | 1.560 | 309000 | 1.560 | | 2010-03-23 | 1.560 | 1.560 | 1.550 | 1.550 | 284900 | 1.550 | I need to se...