date-format

ASP.Net MVC model binding - how to change date format?

穿精又带淫゛_ 提交于 2019-11-30 14:04:54
I have this application, and the default date format must be dd/MM/yyyy (the language is Brazilian Portuguese). I already had set culture and UI culture to pt-BR and now myDate.ToShortDateString() returns the dates as I want. I have no trouble displaying them. The problem is, when the user fills an input field with a date such as 17/08/2011 and submits the form the DateTime parameter to my action becomes null. If I supply a date in the format 08/17/2011 , it works fine. How can I make the ASP.Net MVC model binding to parse my dates correctly? I found what happended. My form was posting via GET

Selecting date range MySQL with date_format

做~自己de王妃 提交于 2019-11-30 13:36:55
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. You should use STR_TO_DATE since you want to convert string back to date SELECT MvtDate, date_format(MvtDate,'%d-%m-%Y') FROM `immmvt` WHERE MvtDate BETWEEN STR_TO_DATE('01-01-2010','%d-%m-%Y') AND STR_TO_DATE('02-01-2010

NSDateFormatter- stringFromDate not returning AM/PM

天大地大妈咪最大 提交于 2019-11-30 13:28:45
NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"hh:mm:ss a"]; NSLog(@"Today's Time: %@", [formatter stringFromDate:[NSDate date]]); The above code just gives the following output Today's Time: 15:46:43 I want the output to be Today's Time: 3:46 PM . I surfed a lot and i did not find a way to show AM/PM. Would be really helpful if someone can help me find a way out. I am using XCode 6.3 and my Device has iOS 8.3 installed in it. Check your device settings for 24 hour time. If it is on, turn it off. Your code is perfectly fine. I am getting output as shown

How to convert date strings to timestamp without knowing the date format

限于喜欢 提交于 2019-11-30 12:08:13
I am trying to write a query to insert a value into a timestamp with no timezone data type field. The value is coming from CSV file. The version I am working with is PostgreSQL 8.1.21 . The CSV file upload is done by the client and it has a date column. The date sometimes comes as '28-Sep-13' and sometimes as '28/09/2013' formats. I tried to use the following to cast the string into timestamp: str_date::timestamp . This works fine if str_date is something like '28-Sep-13' but it won't work if the incoming date has the format '28/09/2013' , when this error occurs: ERROR: date/time field value

WPF/C# - Applying date format to listview

半世苍凉 提交于 2019-11-30 11:45:42
I have a listview bound to a collection of objects. One of the properties is a DateTime object named startDate. It's displayed in the standard 1/1/2001 1:00:00 PM format I want to put the date in yyyy-MM-dd HH:mm:ss.fff format just for display purposes. Is there a way to keep the underlying DateTime object in tact while displaying it in the desired format above? I'd prefer to do this in XAML as opposed to adding a display property to the object or something along those lines. The objects implement the INotifyPropertyChanged interface, if that matters. <ListView x:Name="lvBatches" SelectionMode

PHP Timestamp into DateTime

霸气de小男生 提交于 2019-11-30 11:11:07
问题 Do you know how I can convert this to a strtotime, or a similar type of value to pass into the DateTime object? The date I have: Mon, 12 Dec 2011 21:17:52 +0000 What I've tried: $time = substr($item->pubDate, -14); $date = substr($item->pubDate, 0, strlen($time)); $dtm = new DateTime(strtotime($time)); $dtm->setTimezone(new DateTimeZone(ADMIN_TIMEZONE)); $date = $dtm->format('D, M dS'); $time = $dtm->format('g:i a'); The above is not correct. If I loop through a lot of different dates its all

How to correctly create a date with a specific format? [duplicate]

怎甘沉沦 提交于 2019-11-30 09:31:23
This question already has an answer here: Extract time from date String 8 answers return date type with format in java [duplicate] 1 answer I have the following doubt related how to create a format date in Java. In a Java application I have to create a date (the value have to be the current date) formatted in this way: 2015-05-26 ( yyyy-mm-dd ) So I know that I can obtain the current date simply build a new java.util.Date object, this way: Date dataDocumento = new Date(); but how can I specify my date format? Tnx Try like this: SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date c=

How to change date format (month name) in iReport?

断了今生、忘了曾经 提交于 2019-11-30 08:52:57
问题 I've a requirement to change the date format in iReport. Currently I used an SQL query to collect the data. Here's my query in iReport SELECT DATE_FORMAT(CURRENT_DATE,'%d-%m-%Y') AS currentDate, Upper(e.name) AS name , e.address, Upper(ea.comName) AS comName blablablabla..... and currentDate field will show 28-12-2011 What the requirement is change the month (12) to "Disember" not "December". Or if the month is 1 so in the report should be "Januari". The Month names are [Januari, Februari,

Change date format in the view to dd/mm/yyyy

那年仲夏 提交于 2019-11-30 08:24:03
问题 The default date format in Ruby is yyyy-mm-dd, but I needed them to be dd/mm/yyyy in the view I have wrote a date_format file in config/initializers as: Time::DATE_FORMATS.merge!( :uk_format => '%m/%d/%Y') This didn't work since I need to call date.to_s(:uk_format) in order to use this format. But since I'm using <%= f.text_field :paymentDate %> to display the date, I'm not sure I can add to_s to this case. Can someone help me out please. Edit 1 Actually date.to_s(:uk_format) doesn't work

Convert ISO 8601 to unixtimestamp

99封情书 提交于 2019-11-30 05:42:07
How can I convert 2012-01-18T11:45:00+01:00 (ISO 8601) to 1326883500 (unixtimestamp) in PHP? echo date("U",strtotime('2012-01-18T11:45:00+01:00')); To convert from ISO 8601 to unixtimestamp : strtotime('2012-01-18T11:45:00+01:00'); // Output : 1326883500 To convert from unixtimestamp to ISO 8601 (timezone server) : date_format(date_timestamp_set(new DateTime(), 1326883500), 'c'); // Output : 2012-01-18T11:45:00+01:00 To convert from unixtimestamp to ISO 8601 (GMT) : date_format(date_create('@'. 1326883500), 'c') . "\n"; // Output : 2012-01-18T10:45:00+00:00 To convert from unixtimestamp to ISO