datetime

Extract the Day / Month / Year from a Timestamp on MYSQL

Hello, I have : $date = $actualite['date']; $actualite['date'] is a TIMESTAMP and i was wondering how i can extract from this timestamp the day, then the month, then the year in 3 variables. Thank you for your help : ...

Getting current culture day names in .NET

Is it possible to get the CurrentCulture's weekdays from DateTimeFormatInfo, but returning Monday as first day of the week instead of Sunday. And, if the current culture isn't English (i.e. the ISO code isn't "en") then leave it as default. By default CultureInfo.CurrentCulture.DateTimeFormat.DayNames returns: [0]: "Sunday" [1]: "Mond...

Why were most java.util.Date methods deprecated?

When you look at the javadoc of the java.util.Date class, most of the methods are deprecated. Why was this done? ...

Needs help regarding print in asp.net (need to remove datetime from printpage)

i am using below code to print my content of webpage in asp.net using javascript window.print(document.getElementById('dvPrint')); when i do print, it automatically adds date time on page.. (i think because of page setup) in firefox. please tell me how can i remove this setting. i mean i dont want datetime to be printed automat...

check if date is within time range using joda or standart java api

I have first time as string '12:00:00' and another '19:00:00' next how to check time portion of the day is within these time values? ...

problem while converting object into datetime in c#

Hi, I am getting string value in object let say "28/05/2010". While i am converting it in to DateTime it is throwing exception as : String was not recognized as a valid DateTime. The Code is: object obj = ((Excel.Range)worksheet.Cells[iRowindex, colIndex_q17]).Value2; Type type = obj.GetType(); string strDate3 = string.Empty; double d...

How can I convert bigint (UNIX timestamp) to datetime in SQL Server?

How can I convert bigint (UNIX timestamp) to Datetime in SQL Server? ...

What the heck kind of timestamp is this: 1267488000000

And how do I convert it to a datetime.datetime instance in python? It's the output from the New York State Senate's API: http://open.nysenate.gov/legislation/. ...

PostgreSQL - How to convert seconds in a numeric field to HH:MM:SS

I'm new to PostgreSQL (I have been using MS SQL for many years) and need to convert a numeric column which contains a time in seconds to HH:MM:SS format. I have Googled and found that to_char(interval '1000s', 'HH24:MI:SS') works so I am attempting to use this with my field name: to_char(fieldname, 'HH24:MI:SS') gives an error cannot u...

Storing datetime in database?

I'm working on a blog and want to show my posts in eastern time zone. i figured that storing everything UTC would be the proper way. This creates a few challenges though: I have to convert all times from UTC to Eastern. This is not a biggie but adds a lot of code. And the "biggie" is that I use a short-date time to reference the posts ...

javascript date.utc problem

I'm trying to compare 2 dates using javascript. 1 at the end of the month and 1 at the beginning. I need to compare these 2 dates in seconds so I'm using the Date.UTC javascript function. Here's the code: var d = Date.UTC(2010,5,31,23,59,59); document.write(d); var d2 = Date.UTC(2010,6,1,12,20,11); document.write(d2); The output fo...

PHP Sort a multidimensional array by element containing date

I have an array such as: Array ( [0] => Array ( [id] => 2 [type] => comment [text] => hey [datetime] => 2010-05-15 11:29:45 ) [1] => Array ( [id] => 3 [type] => status [text] => oi [datetime] => 2010-05-26 15:59:53 ) [2] => Array ( [id] => 4 ...

update columns when value is numeric in tsql

i want to normalize date fields from an old badly designed db dump. i now need to update every row, where the datefield only contains the year. update table set date = '01.01.' + date where date like '____' and isnumeric(date) = 1 and date >= 1950 but this will not work, because sql does not do short circuit evaluation of boolean expr...

PHP: Strange Date Problem

Hi, I have two users in my database whose birth date is set to: 1985-01-26 And then i have function which when provided the users' date, tells how many days are left in the birthday. Here is the function: function retage($iy,$im,$id) { if(!empty($iy)>0 && intval($im)>0 && intval($id)>0) { $tdo=$iy.'-'.$im.'-'.$id; ...

Java: JPA classes, refactoring from Date to DateTime

With a table created using this SQL Create Table X ( ID varchar(4) Not Null, XDATE date ); and an entity class defined like so @Entity @Table(name = "X") public class X implements Serializable { @Id @Basic(optional = false) @Column(name = "ID", nullable = false, length = 4) private String id; @Column(name ...

get days of a month in JS/Prototype

Hi, I´m looking for a function/prototype extension, which returns all days of a given month. I couldn't find anything helpful at the standard date() functions (http://www.w3schools.com/jsref/jsref_obj_date.asp). i.e.: getDays(2010-05) // returns something like: { day:'Saturday', date:'2010-01-05' }, { day:'Sunday', date:'2010-...

Help to convert PostgreSQL dates into SQL Server dates

Hello I'm doing some data conversion from PostgreSQL to Microsoft SQL Server. So far it has all went well and I almost have the entire database dump script running. There is only one thing that is now messed up: dates. The dates are dumped to a string format. These are two example formats I've seen so far: '2008-01-14 12:00:00' and the...

How can I get this week's dates in Perl?

I have the following loop to calculate the dates of the current week and print them out. It works, but I am swimming in the amount of date/time possibilities in Perl and want to get your opinion on whether there is a better way. Here's the code I've written: #!/usr/bin/env perl use warnings; use strict; use DateTime; # Calculate num...

sql - get the latest date of two columns

table1 - date1 datetime not null - date2 nvarchar null I want to get the latest date of this two. select date1, date2, (CASE WHEN date1 > CAST(date2 as DateTime) THEN date1 ELSE date2 END) as DateTime) as LatestDate from table1 please note that date2 can be null. in this case, date1 win. ...

What date RFC does Twitter use?

Doc use : Tue Apr 07 22:52:51 +0000 2009 as an example. Can anyone identify the rfc? Cheers ...