Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Round down the Date to the hour

saqib
8 - Asteroid

What is the best way to round down a date to the hour:

 

For e.g. 2015-05-04 21:41:56 should become 2015-05-04 21:00:00

6 REPLIES 6
MarqueeCrew
20 - Arcturus
20 - Arcturus
Try

Datetimetrim([date field],”hour”)

Cheers,

Mark
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
JoshKushner
12 - Quasar
Try this formula.

LEFT([date],14) + PadLeft(ToString(Floor(ToNumber(Substring([date],14,2))),0),2,'0')
JoshKushner
12 - Quasar
Actually go with @MarqueeCrew's answer.
MarqueeCrew
20 - Arcturus
20 - Arcturus

@JoshKushner,

 

I like your style :)

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
JoshKushner
12 - Quasar
You constantly teach me new things @MarqueeCrew. Much appreciated. 😊
jdunkerley79
ACE Emeritus
ACE Emeritus

I'd go with @MarqueeCrew for clarity but I would probably use an adjusted version of @JoshKushner myself:

Left([Datetime],14)+":00:00"
Labels
Top Solution Authors