date-format

Convert data from email header

守給你的承諾、 提交于 2020-01-01 03:11:10
问题 Does anyone could help me how to convert data from email header? I have the next date format from email header: Wed, 28 Apr 2010 21:59:49 -0400 I need to convert them into mysql Date, or timestamp. Thanks! 回答1: You should be using DateTime for this, specifically DateTime::createFromFormat(): $str = 'Wed, 28 Apr 2010 21:59:49 -0400'; $date = DateTime::createFromFormat( 'D, d M Y H:i:s O', $str); Now, you have a Date object in $date , and you can grab the unix timestamp (if that's what you want

Synchronizing on SimpleDateFormat vs. clone

妖精的绣舞 提交于 2020-01-01 01:48:26
问题 We know that the dateformat classes are not thread safe. I have a multi-threaded scenario where dateformats needs to be used. I can't really create a new instance in new thread as SimpledateFormat creation seems to be expensive(the constructor ends up calling "compile" which is costly). After some tests the only two options left for me are: External Synchronization - I really dont want to do this Cloning in each thread - Don't know whether there are some catches? Any suggestions? If guys have

Android CalendarView: How do I get the date in correct format?

£可爱£侵袭症+ 提交于 2019-12-31 04:06:44
问题 The past few days I've been searching for ways to get a 'readable' date out of my calendarview from android 4.0. I can't manage to find a solution or example that suits my problem. I did get it in miliseconds but not in a date format. My problem is: I have a calendarview and I want the selected date by the user, shown in logcat in a dateformat yy-mm-dd. I was used to the datepicker from android 2.2 and I'm not familiar with calendarview and can't find much about it either. Does anyone know a

Creating a D3.js scatterplot with timeline using 'month-year' date values

旧街凉风 提交于 2019-12-31 02:53:05
问题 I have a dataset that lists dates as follows: var dataset = [ ["1-2006", 20], ["3-2009", 90], ["11-2004", 50], ["5-2012", 33], ["4-2008", 95], ["4-2004", 12], ["7-2000", 44], ["5-2006", 67], ["6-2007", 21], ["3-2001", 88] ]; I am trying to map these dates to a time scale on the x Axis and create a simple scatterplot with D3.js. Is it possible to create a scatterplot using a dataset with date values in the format shown above? I tried to create a min date and max date for the domain of my x

DateTime::createFromFormat in PHP < 5.3.0

♀尐吖头ヾ 提交于 2019-12-31 01:48:16
问题 I'm looking for a function identical to DateTime::createFromFormat but I need it to work in an environment running a version of PHP which is older than v5.3. Basically I need to provide a format, like you'd use with the Date() function, and I then need to parse/validate a string against that format, and return a timestamp if the string is formatted correctly and a valid date. Anyone know where I can find something like that, or do I have to write it myself? Again, this has to work with a

Convert decimal year to date

十年热恋 提交于 2019-12-30 12:15:44
问题 I have dates in a table that are stored as decimal years. An example is 2003.024658 which translates to January 9, 2003 . I would like to convert the decimal years to Oracle's date format. I've found someone who's done this in Excel: Decimal year to date formula? =DATE(INT(B1),1,MOD(B1,1)*(DATE(INT(B1)+1,1,1)-DATE(INT(B1),1,1))) However, I can't quite figure out how to convert the logic to Oracle PL/SQL. 回答1: If you start from the assumption that the decimal portion was calculated according

Selecting date range MySQL with date_format

假如想象 提交于 2019-12-30 04:43:09
问题 I've got an issue selecting a date range with MySQL. SELECT MvtDate,date_format(MvtDate,'%d-%m-%Y') FROM (`immmvt`) WHERE date_format(MvtDate,'%d-%m-%Y') BETWEEN '01-01-2010' AND '02-01-2010' mvtDate type is date like 2010-01-01 00:00:00 . When I run the query, the result works for the days and the months but it also show me other result from other years. Like 01-01-2011 etc. 回答1: You should use STR_TO_DATE since you want to convert string back to date SELECT MvtDate, date_format(MvtDate,'%d-

How to get Date in the same format as String

偶尔善良 提交于 2019-12-28 07:07:46
问题 I want to get the Date object which contains Date in the form yyyy-mm-dd after adding few months to existing Date object. Using DateFormat object I have tried this way but its not giving the output as I want. How can I get this Date format in Java? My code- Calendar c=Calendar.getInstance(); DateFormat sdf=new SimpleDateFormat("yyyy-mm-dd"); Date d=cal.getTime(); c.add(Calendar.MONTH,10); Date newd1=c.getTime(); String news=sdf.format(newd1); Date dnew=(Date)sdf.parse(news); String news has

Tapku library -what is the date format in day view

血红的双手。 提交于 2019-12-25 18:42:19
问题 I am using Tapku library in my application. While displaying day view, I am getting the startDate and endDate values from my server. What is the date format used in Tapku library? 回答1: format for tapku library is- [YYYY-MM-DD hour:minute:second] e.g. @"2011-01-01 00:00:00 +0000" for more info visit this Link- tapku Library 来源: https://stackoverflow.com/questions/14848719/tapku-library-what-is-the-date-format-in-day-view

Change default dateformat stored in a database

强颜欢笑 提交于 2019-12-25 11:56:23
问题 I am seeeing my dates are stored in database in this format for a column (datetime datatype) 2011-01-14 10:15:41.787 i.e YYYY-MM-DD way . How could I make the default storage in YYYY-DD-MM format . Do I need to set that for all the DBS, or I can set it for single DB and how ? 回答1: I have the column in datetime datatype, right now it is saving as 2011-01-14 10:15:41.787 , my question is how can I set the db to store it as 2011-14-01 10:15:41.787 That is the crux of the confusion. Just because