Converting Date & Time to Seconds in Mitsubishi FX5U PLC

Learn how to convert Date & Time to seconds in Mitsubishi FX5U PLC (iQ-F Series) using the TimeCalc_F function block in GX Works3. Includes step-by-step guide, RTC register info, and a downloadable sample program. Perfect for PLC developers working with MELSEC iQ-F.

🕒 Converting Date & Time to Seconds in Mitsubishi FX5U PLC (iQ-F Series)

When working with the Mitsubishi FX5U PLC (iQ-F Series), many developers encounter a common challenge: there’s no built-in instruction to directly convert Date & Time to Seconds. While instructions like HTOS and DHTOS ( Hour To Seconds) are available for basic time-to-seconds conversion, handling full DateTime to Seconds conversion requires a different approach.

Fortunately, Mitsubishi provides a powerful workaround using the TimeCalc_F Function Block Library, specifically the M+TimeCalc_DATE2SEC_F_00A function block. Sample available at the END.


🛠 What You Need: TimeCalc_F Library

The solution lies in leveraging the TimeCalc_F.mslm library available in GX Works3. This library includes various function blocks designed for time calculations on the MELSEC iQ-F series PLCs.

🔗 Official Resource: Mitsubishi Electric – MELSEC iQ-F Series


✅ Step-by-Step: Using the M+TimeCalc_DATE2SEC_F_00A Function Block

1. Register the TimeCalc_F Library

  • Open your GX Works3 project.
  • Navigate to:
    [Library Operation] → [Register to Library List] → [Library]
  • In the dialog box, select TimeCalc_F.mslm and click OK.
FX5U DateTime Function Block

2. Insert the Function Block

  • In the element selection window, locate the function block:
    M+TimeCalc_DATE2SEC_F_00A
  • Drag and drop it into your ladder logic.
  • Rename the function block instance as needed.
M+TimeCalc_Date2Sec

3. Configure Inputs

  • Enable Input: Use a suitable control bit (e.g., M1) to trigger the function block.
  • Date and Time Input: Use the PLC’s built-in RTC (Real-Time Clock) values from the special data registers:
    • SD210 to SD215 – This array of six 16-bit values represents the current Date and Time from the FX5U’s clock.

📘 For more on FX5U RTC and time settings, refer to the Mitsubishi FX5U RTC Manual.


🔍 Verifying the Output

  • Compile and transfer your project to the FX5U PLC.
  • Set the control bit (e.g., M1) to ON.
  • The function block will output the converted seconds value.
  • You can observe this value using a label or monitor it via the Watch Window in GX Works3.
Fx5u DateTime to Second

🧠 Why Use This Method?

Using M+TimeCalc_DATE2SEC_F_00A is the most efficient and accurate way to handle DateTime to Seconds conversion in FX5U PLCs, especially when you’re working with:

  • Scheduled event triggers
  • Data logging with timestamp comparison
  • Runtime or uptime calculations
  • Advanced automation logic based on precise timing

While the Mitsubishi FX5U iQ-F PLC lacks a native instruction to directly convert Date & Time to Seconds, this can be easily accomplished using the TimeCalc_F Function Block Library. By registering the library and utilizing the M+TimeCalc_DATE2SEC_F_00A block, you can implement precise time-based control logic in your automation projects.

Need more help with FX5U RTC or time-based programming? Explore the Mitsubishi Electric Global Site for official manuals, support tools, and resources.


💾 Download the Sample Program
To help you get started quickly, we’ve included a ready-to-use sample program demonstrating how to convert Date & Time to Seconds using the FX5U PLC and the M+TimeCalc_DATE2SEC_F_00A function block.

Download File

Mitsubishi PLC FX5U Date Time to Seconds (TimeCalc FB)

Use it as a reference or integrate it into your own automation logic.

Related Reading: Dive Deeper into Mitsubishi FX PLC Clock Handling

Want a complementary tutorial on reading clock data directly from the FX5U’s Real-Time Clock? Be sure to check out our post: Reading Clock Data in Mitsubishi PLC Using TRD Instruction — it walks you through how to use the TRD (Time Read) instruction to capture year, month, day, hour, minute, and second into SD210–SD216 registers

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top