datetime

How should I determine next daylight saving time (DST) transition for a timezone in Perl?

I'm working on a world clock web application, and I'd like to add a function to note how and when each location will next undergo a DST change. I'm using the DateTime and DateTime::Timezone CPAN modules, which seem to provide every conceivable function apart from this one! DateTime::Timezone is an implementation of the tz/Olson database...

How to force LINQ to SQL to pass .NET DateTime as datetime2?

I have a simple query in LINQ to SQL: var id = 23479824; var date = Changes.Where(ch => ch.Id == id).First().Date; var diff = Changes.Where(ch => ch.Id == id).Select(ch => SqlMethods.DateDiffNanosecond(date, ch.Date)).First(); The diff variable should be zero, however is not. The generated SQL is following: DECLARE @p0 DateTime = '20...

Validate DateTime with DataAnnotation

Hi, I'm developing and asp.net app and i'm using data annotations to validate my Input model. In this model, I have one field of type DateTime, and I'd like to know how could I customize the message when the user set an date value invalid. My property in my model: [Required(ErrorMessage = "Informe sua data de nascimento.")] [MinAge(Ida...

Calculating Number of Months between 2 dates

I have the following VB.NET Code: Dim Date1 As New DateTime(2010,5,6) Dim Date2 As New DateTime(2009,10,12) Dim NumOfMonths = 0 ' This is where I am stumped What I am trying to do is find out how many months are between the 2 dates. Any help would be appreciated. ...

Obtaining Time zone in android

Is there a way to obtain the time zone from the callbacks received void onLocationChanged(Location location) using the time information that can be obtained from the location parameter long Time = location.getTime(); Or if there is another way please provide info! ...

Date Formatting in VBScript - Prefix Month with 0 (zero) e.g. 07 instead of 7

Hi, If i use DatePart("m",Now()) ' out put will be 7 but my requirment is to display "07" rather than "7" Is there any direct method to achieve this, or should should I write custom code to prefix "0" zero? ...

OleDB/Access inserting into Date/Time field with a future date

Hi, I am writing a VB.NET application that uses OleDB to connect to an Access database. I want to insert a date that is in the future (it is chosen with a DateTimePicker) into the database. When I chose a date that is today (Jul 15, for example) or in the past it works fine. Whenever I choose a date that is in the future, it crashes. Is...

Java JSONObject for .net webservice deserialisation to DateTime()

I have a .net Webservice which should communicate with a Java app via json. Now I have a method on the server side that looks like this: [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public DateTime GetDate(DateTime input) { return input; } from a C# app I can send a receive DateTime val...

c# .Net DateTimePicker problem

this is what I am doing, //this doesnt set the datetimepicker value to the set value class{ constructor { InitializeComponent(); // -> this initializes all the form components DateTimePicker.Value = System.DateTime.Now.AddDays(30); //->trying to set the date time picker value to a date one month from now. } } //...

How to convert data into DateTime object

How do I convert a date string, in the general form of "ccyymmdd" in to a DateTime object in C#? For example, how would I convert "20100715" in to a DateTime object. Please - No RTFM links to Microsoft Tech Docs. Many Thanks... ...

How does Rails handle I18n date validation?

I used validates_timeliness for validating the date in my application. It functions well for English locale. I added this line to initializers: ValidatesTimeliness::Formats.add_formats(:date, "mmm dd, yy") and Rails can then validate date in this format July 04, 2010. But when I change the locale to some other locale, e.g. Chinese zh...

Get Indian Standard Time(IST) in c#?

When i display my system date using DateTime.Now() function It gives me system date and time and works fine but when i try to run this page on my server it gives me the DateTime of Server which is outside India But i want to pick up the time of India whenever this page is executed on server. I know it is possible through Culture Info Cla...

Format a date in C++

Hi, I have a series of date strings in the format: "30-05-2001" string date1 = "30-05-2001"; I would like to parse the date into Day, Month, Year. Now an easy way of doing this would be just to call the function sscanf. But I'd like to explore other possiblilties and from searching the web the following function from time.h was r...

JavaScript Date.parse() and null dates

I'm trying to sort a list of dates, but I'm struggling with null dates which aren't being handled consistently. So I need something like: var date = Date.parse(dateString); if (!date) { date = Date.MinValue; } but I'm struggling to find the correct syntax. Thanks Update: The bug turned out to be a different problem. I have Dat...

how to get latest date and time in php and mysql using a select statement

how to get latest date and time in php and mysql using a select statement? is that possible My field type is data time it looks like this "2010-06-08 01:41:27" . any help is appreciated guys. edit: sorry not so clear with my question...(ugh!) basically I have a column in my table which has a field of datetime (did I say it right, it has...

simple date formatter issue in java

I want to parse date of following type: 2010-07-13T17:27:00.000Z How can i do it using simple date formatter in java? what format is to be used? ...

PHP: strtotime is returning false for a future date?

here are some debug expressions i put into eclipse, if you don't believe me: "strtotime("2110-07-16 10:07:47")" = (boolean) false "strtotime("2110-07-16")" = (boolean) false i'm using it in my function which returns a random date between the start and end dates: public static function randomDate($start_date, $end_date, $format =...

PHP: parsing a date of any format (especially: 2008-10-20, 2008/10/20, 2008.10.20, Nov. 20/08)

strtotime("25/03/1957") returns false. what will satisfy all of these date formats? i can't imagine how long it would take to actually make my own, so i hope there's already one out there you know of. thanks! ...

DateTime formatting Rails

Hi I have "Date.today + 2.days" I need to format it using .strftime, but with the "+2.days" it doesn't recognize that method.Any ideas? ...

What's the best way to detect date formats in user submitted data?

I'm reading csv data uploaded by users in my Ruby on Rails app. When a user specifies that a particular column has dates(or times), I want to be able to automatically detect the format. This means it can be in American or British formats (any of dd/mm/yy, mm/dd/yy, yyyy-mm-dd, 12 Feb 2010, etc etc) I have tried parsedate in Ruby but i...