datetime

Adding DateTime to ListView?

How can I add a DateTime value along with 2 string values into a ListView? I've tried... String[] row = { Time.Value.ToString(), "Example Text", "Example Text"}; listView1.Items.AddRange(row); but I get conversion errors. ...

Convert String to DateTime?

How can I convert this string, 12:00 AM, into a DateTime? ...

Get date format like "Y-m-d H:i:s" from a php date

Hello, did someone knows a way to get a string from date that contains the format of the date? <?php $date = date ("2009-10-16 21:30:45"); // smething like this? print date_format ($date); ?> I ask this because I'd like to optimize this function I've wrote, usual to get date with a different timezone from server, without ...

DateTime.Add(TimeSpan) performance vs DateTime.AddDays/Hours/etc* methods.

Is there any performance difference in using DateTime.Add(TimeSpan) vs. DateTime.AddDays(double), DateTime.AddHours(double), etc.? ...

listView.Items.Contains with DateTime/String?

How do I check if a listView contains a DateTime or String? I've tried if (!listView1.Items.Contains(SetAlarm.Value)) But it cannot convert System.DateTime to System.Windows.Forms.ListViewItem. ...

Finding Day in T-SQL

Hi, Please let me know how can I find if it is Sunday on given Date? EDIT: From answers another thing comes to my mind: How to find what is first day of week? ...

add seconds to a date

i need to add a seconds in a date. for eg:if i have a date as 2009127000000, i need to add the seconds to this date. also for eg 20091231235957 adding 50 seconds. is this possible in C? ...

Is there a standard way to represent TSQL Minimum date in ASP.NET

Hi all, I want to initialize a DateTime entity to the minimum possible date in TSQL. (as you all know its 1/1/1753) Is there a standard way to represent this date in ASP.NET ? I mean doing something like DateTime.SQLMinValue (this doesn't exist), instead of doing new DateTime(year, month, date) ? If so, please post it, Thanks! ...

Trouble with Calendar homework in C

I am writing a program that get month and year from the user, and then print out the calendar. But the calendar is only correct in January (every two years). How do I make the other months correct? What am I doing wrong? #include "stdafx.h" void printMonth (int* startDay, int* days); int _tmain(int argc, _TCHAR* argv[]) { int s...

Parse string to DateTime

Hi! I have a source where dates comes in this string form: Sat Sep 22 13:15:03 2018 Is there any easy way I can parse that as a datetime in C#? I've tried with DateTime.(Try)Parse, but it doesn't seem to recognize this specific format... ...

How to get duration in terms of minutes by subtracting a previous time stamp from the present time in PHP?

How to get duration in terms of minutes by subtracting a previous time stamp from the present time in PHP? The format of time stamp is like 2009-12-05 10:35:28 I want to calculate how many minutes have passed. How to do it? ...

How to calcuate elapsed time in terms of minutes in MySQL

There is a time stamp column/field in a table, and the format is like 2009-12-05 10:35:28, Now I want to get the time in terms of minutes(How many minutes have elapsed) elapsed from then on, how to do it? ...

Perl DBD::ODBC Issues with Oracle Date Formats

I am using Perl's DBD::ODBC to connect to an Oracle database. However, an issue arises when I try to execute a select query using a date in the where clause. It seems this issue occurs because of the database's date format being DD-MON-RR (see DBD::ODBC::FAQ). Since I cannot change the database's settings, can anyone suggest a workaro...

Django DateTime field to generate timestamp fields withOUT timezone

I am working on a Django application where I need all the postgres represented datetime fields to be saved in UTC (as they should). When I'm creating models with DateTime fields they database representation is generated as "timestamp with time zone". Although I can manually alter the tables to remove the timezone from the fields, I was ...

.NET DateTime.Parse

When trying to use the Parse method on the DateTime class I get an exception thrown: String was not recognized as a valid DateTime. The string reads as "26/10/2009 8:47:39 AM" when outputted. This string is obtained from a group on a match from a regex. None of the strings obtained from this match group will parse to datetime. (WT...

Confused over some date/time calculations

So, I am trying to calculate the time between two dates that fits certain criteria (here: work / non-work) and I'm confused about the results as I can't find out why it's wrong. But first, some code; **Input Date A:** 2009-01-01 2:00 pm **Input Date B:** 2009-01-02 9:00 am So, as you can see, the total timespan (calculated e.g. by Da...

Matching Outlook Week Numbering in .Net

Hi, my current app uses week numbers (as in week x of 52). The business want this to match the default MS Outlook behaviour, which is a rule it calls 'Starts on Jan 1'. (We use weeks starting on Monday. There is a mixture of Outlook 2003 and 2007). This rule looks at the working week which includes the 1st of the year, and makes that...

In PHP, example of checking to see if 30 minutes have elapsed?

I have an authenticate function. The user is automatically logged out after 30 minutes. I'd like to store the time of login (timestamp?) in the authenticate function. I will then update that time each time a function requiring authentication is called. If 30 minutes have passed since the last call, it will automatically reauthenticate. I...

DateTime/bool and Null values in .Net

Utilizing .Net I am inheriting from an older class that has DateTime and bool parameters as part of its constructor. These values are pulled from a SQL database and in the SQL database these values can be null. When I populate my class and call the base constructor this fails because DateTime and bool cannot have null values in .Net. ...

date format in asp.net versus in console application

I'm deploying a .NET applications to another machine. in console application, the value of DateTime.Today.ToLongDateString(); is 10 December 2009 while in web application the value is 23 ذو الحجة 1430 < equivalent in higri calendar How does the web application get the culture from, and why is it different than the console a...