---
schema_version: "1"
id: e9beedd905906d8da773d23bc088a18bcf57a6f62b267d6934f75d98f0ab9a6e
title: "Use Case 4: Convert Hours in the Day to Day Parts"
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/data/264-0-0/c360_a_use_case_4.md
canonical_url: https://help.salesforce.com/s/articleView?id=data.c360_a_use_case_4.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 5566e9bbde152e5773f05c64809f8e504178ec3b09b2ed68b373b13ea9b464f6
description: This use case converts hours in the day into day parts; for example, morning or afternoon.
products:
  - Data 360
release: "264"
---
# Use Case 4: Convert Hours in the Day to Day Parts

This use case converts hours in the day into day parts; for example, morning or afternoon.

 
| Raw Data | Goal |
| --- | --- |
| Column named Hour of Day. | Create the formula field “Day part” that assesses the hour of the day and determines if the value is Morning, Midday, Afternoon, Evening, or Overnight. |

1. For Field Label, enter Day part.
2. For Formula Return type, select Text.
3. In the syntax editor, enter the formula: IF(sourceField\['Hour of Day'\] >= 6 && sourceField\['Hour of Day'\] < 10, 'Morning', IF(sourceField\['Hour of Day'\] >= 10 && sourceField\['Hour of Day'\] < 15, 'Midday', IF(sourceField\['Hour of Day'\] >= 15 && sourceField\['Hour of Day'\] < 19, 'Evening', IF((sourceField\['Hour of Day'\] >= 19 && sourceField\['Hour of Day'\] < 24) || (sourceField\['Hour of Day'\] >= 0 && sourceField\['Hour of Day'\] < 6), 'Overnight', "Unclassified")))).
    
    If the raw data doesn’t have a separate column for Hour of Day, you can use the same formula by reading in a Date with Timestamp and parse out the timestamp.
4. In the test input box, validate the formula using these combinations.
    
    - “Hour of Day” with the value of “6” returns “Morning”.
    - “Hour of Day” with the value of “12” returns “Midday”.
    - “Hour of Day” with the value of “18” returns “Evening”.
    - “Hour of Day” with the value of “19” returns “Overnight”.
    - “Hour of Day” with the value of “23” returns “Overnight”.
    - “Hour of Day” with the value of “0” returns “Overnight”.
    - “Hour of Day” with the value of “5” returns “Overnight”.
5. Click **Save**.
6. Verify that “Day part” is added as a new field.