新しい投稿

検索

記事
· 2025年6月30日 2m read

ObjectScript での日付の比較方法(ObjectScript での SQL 関数実行方法)

これは InterSystems FAQ サイトの記事です。

ObjectScript で日付の比較を行う場合、一旦 $HOROLOG 形式(内部数値)に変換することで算出しやすくなりますが、SQL 関数を利用して算出することもできます。

ObjectScript から SQL 関数を実行するには、%SYSTEM.SQL.Functions クラスを使用します。

※ 2021.1以前のバージョンでは、%SYSTEM.SQL クラスを使用します。

%SYSTEM パッケージは、システム・オブジェクトと呼ばれ ObjectScript では $SYSTEM 特殊変数を利用して以下の構文で実行します。

  $SYSTEM.サブパッケージ名.クラス名.メソッド名() または $SYSTEM.クラス名.メソッド名()

 

以下、SQL 関数 DATEDIFF を使用して日付の比較を行う例です。

USER>write $system.SQL.Functions.DATEDIFF("dd","2025-01-20","2025-03-20")
59

 

分での比較

USER>write $system.SQL.Functions.DATEDIFF("mi","2025-01-20","2025-03-20")
84960

 

秒での比較

USER>write $system.SQL.Functions.DATEDIFF("ss","2025-01-20","2025-03-20")
5097600

 

この他、DATEADD 関数を使って指定日付に日付や時刻を追加することもできます。

指定の日付に10年追加する

USER>write $system.SQL.Functions.DATEADD("year",10,"2025-01-20")
2035-01-20 00:00:00

 

指定の日付の25日前

USER>write $system.SQL.Functions.DATEADD("day",-25,"2025-01-20")
2024-12-26 00:00:00

 

指定日時の16時間前

USER>write $system.SQL.Functions.DATEADD("hour",-16,"2025-01-20 13:10:00")
2025-01-19 21:10:00

 

指定の日付時刻の指定箇所のみを取り出す DATEPART 関数の実行例は以下の通りです。

hour を取り出す

USER>write $system.SQL.Functions.DATEPART("hour","2025-01-20 13:10:00")
13

 

dayofyear を返す

USER>write $system.SQL.Functions.DATEPART("dayofyear","2025-10-20 13:10:00")
293

 

dayを返す

USER>write $system.SQL.Functions.DATEPART("day","2025-10-20 13:10:00")
20

 

この他のSQL関数については、ドキュメントをご参照ください。

ディスカッション (0)1
続けるにはログインするか新規登録を行ってください
お知らせ
· 2025年6月30日

[Webinar] The Future of Healthcare Integration with Health Connect & InterSystems

Hey Community,

We're excited to invite you to the next InterSystems UKI Tech Talk webinar: 

👉The Future of Healthcare Integration with Health Connect & InterSystems

⏱ Date & Time: Thursday, July 3, 2025 10:30-11:30 UK

Speakers:
👨‍🏫 @Mark Massias, Senior Sales Engineer, InterSystems
👨‍🏫 Mike Fitzgerald. Head of Customer Solutions, ReStart

2025 Tech Talk Social Tile 19 Jun (draft) (3).png

As the NHS continues to advance its digital transformation agenda, seamless interoperability has become a crucial priority for healthcare IT professionals. InterSystems Health Connect is leading the way as a superior integration engine, offering enhanced scalability, security, and performance to support evolving data exchange needs.

This exclusive webinar will explore how you can overcome interoperability challenges, streamline system migrations, and benefit from real-world success stories—ensuring you stay ahead of NHS standards for connected care.

Join us for an insightful session where InterSystems and our highly experienced implementation partner ReStart will showcase the benefits of Health Connect, providing actionable strategies for seamless integration and transitioning from legacy solutions. Discover how Health Connect supports NHS standards out-of-the box and enhances connectivity across trust and regional healthcare networks.

This is your opportunity to future-proof your healthcare IT strategy and drive smarter, more efficient data integration.

>> REGISTER HERE <<

1件の新着コメント
ディスカッション (1)2
続けるにはログインするか新規登録を行ってください
ディスカッション (4)2
続けるにはログインするか新規登録を行ってください
お知らせ
· 2025年6月30日

[Video] Uncovering and Accelerating Customer Value Through Collaboration

Hi Community,

Enjoy the new video on InterSystems Developers YouTube:

⏯ Uncovering and Accelerating Customer Value Through Collaboration @ Global Summit 2024

Gone are the days of old school “vendor-customer” and sometimes adversarial relationships. Today, the most successful relationships between customers and their solution providers are viewed as "partnerships" built on measurable business value achievement and true mutual collaboration. Hear from panelists as they share strategies and examples of how customer success, solution adoption and value can be achieved and accelerated across the customer journey, from initial sale, through on-going execution year 1 to year n. Attendees will gain a deeper understanding of the collaborative efforts required for long-term achievement and get a glimpse into the future of customer success engagement strategies.    

Presenters:
🗣 @Jim Breen, Learning Services Director, InterSystems
🗣 @Jenny Ames, Manager, Online Learning Content, InterSystems
🗣 Art Dirik, Head of Customer Success, InterSystems
🗣 @Chi Nguyen-Rettig, Chief Technology Officer, LEAD North, LLC  

Discover what’s next — watch the video and subscribe to stay informed.

ディスカッション (0)1
続けるにはログインするか新規登録を行ってください
質問
· 2025年6月30日

With a CPE Tracker, remain organized and compliant.

Keeping up with your continuing education is more vital than ever in the current fast-paced professional environment. That's where a CPE Tracker comes in. Using a CPE Monitor guarantees you stay compliant, organized, and stress-free whether you're a CPA, accountant, or any authorized professional mandated to fulfill continuing education requirements. No more certificate or email searches; just one central platform to handle everything.

Definition of a CPE Tracker and Its Relevance

A CPE Tracker is a computer program that assists professionals in monitoring their Continuing Professional Education (CPE) credits. Most sectors that need licensing also demand a certain number of CPE hours per year or reporting cycle. Tracking these credits manually can take a long time and be error-prone. By tracking completed courses, sorting certificates, and automatically determining your remaining credit requirements, a CPE Tracker streamlines the process.

Important Features That Make a Difference

Modern CPE Monitor systems have features that go beyond just credit counting. For approaching deadlines you can set reminders, produce reports for licensing boards, and even include your course providers for automatic updates. Dashboard features on some of these tools provide total view of your status by subject matter or renewal period, therefore breaking down your progress. These qualities simplify avoiding last-minute panics and missed deadlines.

Who Should Employ a CPE Tracker?

 Although CPAs require CPE Trackers, financial advisors, auditors, legal experts, healthcare       administrators, and anyone subject to continuing education requirements find them quite useful.  Employers and team leaders can also use CPE Monitors to oversee their staff's compliance and development. By streamlining CPE management, these tools free up time for more strategic work and professional growth.

      Selecting the Correct CPE Monitor for You

Choose a CPE Tracker based on things like user-friendliness, integration with course providers, reporting capabilities, and mobile access. Look for approved platforms by your licensing body and automatic features that lessen manual entry. A great CPE Monitor helps you to become compliant as well as simplifies, clarified, and more efficient the procedure.

Finally: Use a CPE Tracker and CPE Monitor to make compliance simple.

Remaining compliant is not necessarily burdensome; with the appropriate CPE Tracker and CPE Monitor, managing your education credits becomes a straightforward, simplified process. Stay organized, avoid missed deadlines, and take charge of your professional growth using tools designed to make CPE tracking easy and effective.

ディスカッション (0)1
続けるにはログインするか新規登録を行ってください