datetime

Extracting value from Form Date Element on Submit

I'm writing a Drupal module and have run into what should be a trivial problem; Consider a 'Person' type node which includes a 'Date of Birth' property. I've configured the database table to use an int field to store the date in UNIX format (same as Drupal Core) but of course I need to provide a method for the user to specify the value ...

how to check now() falls between two specific dates?

I've a announcement table with the structure, Msgid int, title varchar(150) message text date_from datetime date_to datetime I've want to list all the announcements which will be due today (i.e) announcements of which today's date falls b/w date_from and date_to. any ideas? ...

How to format a datetime with minimal separators and timezone in VBScript?

I have the following code in C#: DateTime dt = GetDateTime(); string formatted = dt.ToString("yyyyMMddTHHmmsszz"); which returns a date in the following format: 20100806T112917+01 I would like to be able to get the same results in VBScript (for a legacy ASP application). It is especially important that I get the UTC offset informat...

How to show time intervals in datagridview?

I am working on an application in which I have two database fields. One is the Date, and the other is the time of the insertion of the record with data type VARCHAR(10). I need to fill the DataGridView with these fields. The problem is that I have to fill the time as the elapsed time between those datetimes. If the record is added at ...

Excel 2007: Count backwards by month given a starting month

I am working in Excel 2007. My preference would be to do this without VBA. I am trying to count backwards a number of months starting from a given date. For example: Start Date: July, 2010 Countdown: 12 months Should result in: Jun 2010 May 2010 Apr 2010 Mar 2010 Feb 2010 Jan 2010 Dec 2009 Nov 2009 Oct 2009 Sep 20...

Problem with date, membership expired but it isn't yeat

Hi there, I need to modify my valid notification script (which notify members, before membership expiration, on expiration day and so on), to work on specific way. So my expires column in database (MySQL) is datetime type so value in it for example look like this: 2010-08-08 13:46:38 Here is a thing: Script can be called from backend...

MySQL: Delete all rows older than 10 minutes

I have a timestamp field in my table. How do I delete records older than 10 minutes old? Tried this: DELETE FROM locks WHERE time_created < DATE_SUB( CURRENT_TIME(), INTERVAL 10 MINUTE) Didn't work. What am I doing wrong? EDIT: I used this code: SELECT time_created, CURRENT_TIMESTAMP, TIMESTAMPDIFF( MINUTE, time_created, CURRENT_TIM...

DateTime locale settings

We are haveing issue with DateTime on one of our application servers. The issue is the datetime is picking the locale settings as en-US and we want to use en-GB. I tried to Change the server Regional and Language options to UK still having the same issue. I could force DateTime to use en-GB but this will require code changes at various l...

Datetime/time issue with python (18 hours off)

I'm working on making a small ban system, and the snippet below will tell the client how much time of their ban is remaining. The problem: When you call Bans.timeleft_str(), rather then showing something less then a day, it will show the timestamp + 18 hours. Snippet: http://pastebin.com/Zumn0tLv This problem occurs if I change self.l...

why is the datetime in database different when I output it?

In my database on heroku, it shows contactemail.created_at = "2010-08-08 17:16:19" However, when I use puts.contactemail.created_at I get something different. I get: 2010-08-08 10:11:13 -0700 I need to input that value through an API to another application, and I am pretty sure that the first format is what it wants. If it doesn't t...

How do I convert a date of the format DDMMMYYYY into a db storable date

Hi guys my application parses text files where date values are stored in the format: DDMMMYYYY eg: 12MAR2009. I noticed that inserting this value as it is into a database datetime value doesn't work at all. How do I convert this into a datetime value which can be entered into a database. My application is in php. ...

Python: date formatted with %x (locale) is not as expected

I have a datetime object, for which I want to create a date string according to the OS locale settings (as specified e.g. in Windows'7 region and language settings). Following Python's datetime formatting documentation, I used the %x format code which is supposed to output "Locale’s appropriate date representation.". I expect this "repr...

Calculating Summary Statistics by Day/Week/Month

In R, I have a data-frame of various statistics recorded throughout the day. (For example, heart-rate) . The time-stamps for each measurement-entry are automatically created, and I have already converted them into a POSIXt class element. The number of observations varies from day to day. I am wondering how I can calculate summary sta...

PHP Business days stop at weekends create a new start date on monday

Hi already i'm using this code from another question - which adds two extra days to endday in the case of weekends function add_business_days($startdate,$buisnessdays,$holidays,$dateformat){ $i=1; $dayx = strtotime($startdate); while($i < $buisnessdays){ $day = date('N',$dayx); $datex = date('Y-m-d',$dayx); if($day < 6 &&...

jQuery Date and TimePicker

I am trying to use the date and time picker located at http://razum.si/jQuery-calendar/TimeCalendar.html However this picker works only if the jquery-ui.js is not included. It looks like it conflicts with something with the base jquery-ui.js. The jquery core api is required. Any insight would be helpful. thanks in advance. The cod...

How to get date in a specific timezone?

greetings all i am using the following method to get the current time in GMT timezone public static Timestamp getCurrentTimeGMT() { Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT")); long time = c.getTimeInMillis(); long offset = TimeZone.getDefault().getOffset(time); return new Timestamp(ti...

How to convert a string with date and time to DateTime data type ?

A client is sending a string containing a date in format YYYYMMDDHHmmSS (e.g. 201004224432). There are no separators like / or -. How can I easily convert this to a DateTime object? Convert.ToDateTime() does not work. ...

Using datetime and manipulating date strings using python

I have a file of the following format Summary:meeting Description:None DateStart:20100629T110000 DateEnd:20100629T120000 Time:20100805T084547Z Summary:meeting Description:None DateStart:20100630T090000 DateEnd:20100630T100000 Time:20100805T084547Z I need to create a function that would retrieve "Summary" at a given "date" and "time"....

validating time and date fields .

hi, Is there any way to validate the time field based on the current time. I already posted a simillar question but now i decided to move away from that option and just want to try this. 1) ask an user to select time (I am using jquery timepicker). 2) See if that time is future time and not which is already gone. I also have a datepic...

insert date in a word document

Hi everyone, I'm working on a Word document which has a table on each page. Each table contains several occurrences of the word "Datum". By doubleclicking this word "Datum", this word should be replaced with the system date. And this date should be "frozen", i.e. it mustn't adapt itself when opening the document on a different day. ...