Skip to content

Incorrect Result - Minutes without leading zero #3

@ABoBo555

Description

@ABoBo555

See here 👉 Line 108 of 10_Date_Time_Formats.sql

This query generates 'month day' eg.(June 15) value, not minutes without zero.

SELECT 
    'm', 
    FORMAT(GETDATE(), 'm'), 
    'Minutes without leading zero'
Image

This is the correct way to make it works.

SELECT 
    'mm (custom)', 
    CAST(CAST(FORMAT(GETDATE(), 'mm') AS INT) AS VARCHAR), 
    'Minutes without leading zero'
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions