1. 程式人生 > >Why does my NSDateFormatter sometimes return an a.m. or p.m. with yyyyMMddHHmmssSSS

Why does my NSDateFormatter sometimes return an a.m. or p.m. with yyyyMMddHHmmssSSS

需要設定Locale

NSDateFormatter *dateFormatter = [[[NSDateFormatteralloc] init] autorelease];

 [dateFormatter setDateFormat:@"yyyyMMddHHmmss"];

 NSDate *currentDate = [[[NSDate alloc] init] autorelease];

 [dateFormatter setCalendar:[NSCalendarautoupdatingCurrentCalendar]];

[dateFormatter setLocale:[[[

NSLocalealloc] initWithLocaleIdentifier:@"en_US"] autorelease]];

NSString *strDate = [dateFormatter stringFromDate:currentDate];


http://stackoverflow.com/questions/7072267/why-does-my-nsdateformatter-sometimes-return-an-a-m-or-p-m-with-yyyymmddhhmmss

相關推薦

Why does my NSDateFormatter sometimes return an a.m. or p.m. with yyyyMMddHHmmssSSS

需要設定Locale NSDateFormatter *dateFormatter = [[[NSDateFormatteralloc] init] autorelease];  [dateFormatter setDateFormat:@"yyyyMMddHHmm

why does it suck to be an in-house programmer?

done lin programs man net soft control ams som Number one: you never get to do things the right way. You always have to do things the exp

Ask HN: Why don't we seriously seek an alternative if we're unhappy with Google?

> It would be great if a superior alternative existed but other search engines don't come close.I disagree. I use DDG and vast majority of cases fall in

解決Linux時間A.M.與P.M.顛倒的問題

環境 local 北京 color info asi src 51cto 問題 最近搭openstack測試環境的時候發現Linux系統的時間不對,比如說上午10點10分在Linux中date的輸出為Mon Apr 8 22:10:00 EDT 2019試過很多辦法都不行

Why does the memory usage increase when I redeploy a web application?

man weakref solution read cannot erro try cto tag That is because your web application has a memory leak. A common issue are "PermGen"

Why does a Java class compile differently with a blank line?

I have the following Java class public class HelloWorld { public static void main(String []args) { } } When I compile this file and run a sha256

Why does a 'for' loop behave differently when migrating VB.NET code to C#?

Because the for in VB is a different semantic than the for in C# (or any other C-like language) In VB, the for statement is specifically incrementing a

Ask HN: Why does a video rewind on YouTube require a rebuffer?

I've noticed that even after I've fully downloaded a video, it appears to rebuffer the entire thing when I replay it. Why is this? Why not just stream it o

Presidential alert: Why did Trump just text me about a 'test of the National Wireless Emergency Alert System' and how does it wo

Donald Trump is texting everyone in the US the exact same message. "THIS IS A TEST of the National Wireless Emergency Alert System," the message will begin

What is a Stablecoin, and Why Does It Matter?

In the volatile world of crypto where a coin can be worth five cents one day and five dollars two months later, the idea of a “stablecoin” — a cryptocurren

What is a decision tree and why should my chatbot use it?

The most effective way to discover the intent behind your customer's questions and provide the right answer is by using a decision tree. What are they and

Why does typeof array with objects return “Object” and not “Array”?

https://stackoverflow.com/questions/4775722/check-if-object-is-an-array One of the weird behaviour and spec in Javascript is the typeof Array is Obje

Why does a mobile phone need more than 2 cameras?

Why does a mobile phone need more than 2 cameras?Now we have smartphones with 4 lensesThe recently launched Samsung A7 has 3 rear cameras, while the A9 has

Why does Double.NaN==Double.NaN return false?

開發十年,就只剩下這套架構體系了! >>>   

Why does Delphi XE7 IDE hangs and fails on out of memory exception?

problem cycle soft addition des microsoft same hour bsp 引自: https://stackoverflow.com/questions/27701294/why-does-delphi-xe7-ide-ha

Failed to open zip file. Gradle's dependency cache may be corrupt (this sometimes occurs after a net

AndroidStudio 3.2.1 遇到下面這個錯誤 解決辦法: distributionUrl=https://services.gradle.org/distributions/gradle-4.6-all.zip https修改成http

A filter or servlet of the current chain does not support asynchronous operations

(原文是我之前的一個賬號,在17年3月份寫的一篇部落格,那個賬號不打算繼續用了,遷過來) https://blog.csdn.net/alun1314deai/article/details/61195121 非同步請求需要配置,允許其非同步請求才可以,包括servlet和相關的過濾器,一整

Why LSTMs Stop Your Gradients From Vanishing: A View from the Backwards Pass

LSTMs: The Gentle Giants On their surface, LSTMs (and related architectures such as GRUs) seems like wonky, overly complex contraptions.

[leetcode]215. Kth Largest Element in an <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="67261515061e272d061106">[email 

Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sor

What exactly is an A.I. Model? An ELi5.

What exactly is an A.I. Model? An ELi5.Machine Learning Models. We hear about them all the time. They look and sound awesome, but can they predict and reac