問題タブ [formatdatetime]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
8 に答える
4219 参照

multithreading - Delphi Win API CreateTimerQueueTimer threads and thread safe FormatDateTime crashes

This is a bit of a long question, but here we go. There is a version of FormatDateTime that is said to be thread safe in that you use

to get a value and then you can use it like so;

Now imagine two timers, one using TTimer (interval say 1000ms) and then another timer created like so (10ms interval);

Now the narly bit, if in the call back and also the timer event you have the following code;

Note there is no assignment. This produces access violations almost immediatley, sometimes 20 minutes later, whatever, at random places. Now if you write that code in C++Builder it never crashes. The header conversion we are using is the JEDI JwaXXXX ones. Even if we put locks in the Delphi version around the code, it only delays the inevitable. We've looked at the original C header files and it all looks good, is there some different way that C++ uses the Delphi runtime? The thread safe version of FormatDatTime looks to be re-entrant. Any ideas or thoughts from anyone who may have seen this before.

UPDATE:

To narrow this down a bit, FormatSettings is passed in as a const, so does it matter if they use the same copy (as it turns out passing a local version within the function call yeilds the same problem)? Also the version of FormatDateTime that takes the FormatSettings doesn't call GetThreadLocale, because it already has the Locale information in the FormatSettings structure (I double checked by stepping through the code).

I made mention of no assignment to make it clear that no shared storage is being accessed, so no locking is required.

WT_EXECUTEINTIMERTHREAD is used to simplify the problem. I was under the impression you should only use it for very short tasks because it may mean it'll miss the next interval if it is running something long?

If you use a plain old TThread the problem doesn't occur. What I am getting at here I suppose is that using a TThread or a TTimer works but using a thread created outside the VCL doesn't, that's why I asked if there was a difference in the way C++ Builder uses the VCL/Delphi RTL.

As an aside this code as mentioned before also fails (but takes longer), after a while, CS := TCriticalSection.Create;

And now for the bit I really don't understand, I wrote this as suggested;

and then inside each type of timer the code is;

This causes the same kinds of failiures, as I said before the fault is never in the same place inside the CPU window etc. Sometimes it's an access violation and sometimes it might be an invalid pointer operation. I am using Delphi 2009 btw.

UPDATE 2:

Roddy (below) points out the Ontimer event (and unfortunately also Winsock, i.e. TClientSocket) use the windows message pump (as an aside it would be nice to have some nice Winsock2 components using IOCP and Overlapping IO), hence the push to get away from it. However does anyone know how to see what sort of thread local storage is setup on the CreateQueueTimerQueue?

Thanks for taking the time to think and answer this problem.

0 投票する
1 に答える
1661 参照

xslt - format-dateTimeでゼロパディングを指定する

xsltには次のものがあります

これにより、出力が得られます(現在の日付が2010年1月12日である場合)。

私の問題は、次のようにフォーマットが必要なことです。

では、月と日のゼロパディングを取得するにはどうすればよいですか?具体的には、フォーマット画像'[Y0001][M01][D01]'の何が問題になっていますか。

参考までに、XMLSpy2005に同梱されているXSLTエンジンを使用しています。

0 投票する
1 に答える
836 参照

xslt - xslt umbraco.library:FormatDateTime と / (スラッシュ) の使用

これは本当の XSLT の質問ではないかもしれませんが、Umbraco の質問に近いものです。

書かれているこの関数は、expexted として別の形式を出力します。

現在の日付でこれら 3 つの「2 番目の引数」を指定して呼び出された場合

次に、出力は次のようになります。

Br. アンダース

0 投票する
1 に答える
41194 参照

datetime - JSTLで日付をフォーマットする方法

私たちのサイトにあるすべてのニュース項目を通過するループがあります。フィールドの 1 つは date${newsitem.value['Date']}で、ミリ秒単位で指定されます。この日付を月/日/年の形式で Web ページに表示したいと思います。JSTL 形式のタグ<fmt:formatDate>が役立つと思ったのですが、うまくいきませんでした。あなたはそれを行う方法を知っていますか?

0 投票する
2 に答える
1490 参照

xslt - XSLT2 format-dateTime - ドット/ピリオドなしの AM/PM

XSLT 2 format-dateTime 関数についての質問です。

AM/PM をドット/ピリオド (AM/PM) で表示しない方法を教えてください。

以下のコードは空白を返しますか?

ありがとう、ウィル

0 投票する
6 に答える
44241 参照

php - PHP Zend 日付形式

以下の形式でタイムスタンプをデータベースに入力したいと考えています。

上記の形式を取得するにはどうすればよいですか?

私が使うとき

月 dd, yyyy hh:mm:ss PMを返します

また、JavaScript カレンダーを使用して選択した日付を挿入すると、dd-mm-yyyy形式で返されます

さて、これらの両方の形式を yyyy-mm-dd hh:mm:ss に変換して、データベースに挿入できるようにします。日付形式がデータベース フィールド形式と一致しないため、日付は挿入されず、* 00-00-00 00:00:00 *のみで埋められます。

ご回答ありがとうございます

0 投票する
1 に答える
16260 参照

javascript - CRM 2011: javascript を使用して文字列から日時フィールドを設定する

フィールドの 1 つが DataTime フィールドである新しいレコードを作成しようとしています。

「Thu Sep 01 19:25:20 2011 の日時形式が無効であるか、値がサポートされている範囲外です」というメッセージが常に表示されます。エラー。

複数の形式オプションを試しました。Date.parse、Date.parseExact、...を使用すると、最後の試みは次のとおりです。

0 投票する
2 に答える
5650 参照

sql - 「1 週間前」、「2 週間前」、「1 か月前」、「1 年前」などの「時間前の日付」を表示する SQL クエリ

次の形式で日付を表示するクエリが必要です。

過去 7 日間の日付 -> 「1 週間前」 過去 7 ~ 14 日間の日付 -> 「2 週間前」 など…</p>

過去 30 日以内の日付 → 「1 か月前」 過去 30 ~ 60 日以内の日付 → 「2 か月前」 など

過去365日以内の日付→「1年前」 過去365日~730日以内の日付→「2年前」 など...

皆さんが私を正しい方向に向けることができれば、感謝します。

ありがとうございました

0 投票する
1 に答える
846 参照

delphi - Delphi twitter タイムスタンプを TDatetime に変換する方法

この質問に続きます: Twitter タイムスタンプを DateTime に変換する方法は?

TwitterのタイムスタンプをTDateTimeに変換するコードは何ですか?

編集: StrDateTime(const 文字列;TFormatSettings);

新しいフォーマットを導入する方法を理解するためだけに、その一部を処理できました。

0 投票する
1 に答える
3014 参照

jsp - ミリ秒単位で表された日付でJSTLのformatDate関数を使用する

通常、私は以下を使用して、JSPページにDateオブジェクトを表示します。

オブジェクトの場合blogEntry.createdはうまく機能しjava.util.Dateます。しかし、ミリ秒単位の日付しかない場合、日付を表示する適切な方法は何ですか?最初に、次のようなエスケープされたJavaコードで変数を設定する必要があります<%=new java.util.Date(millis);%>か?それとももっと良い方法はありますか?