39
Views
17
Comments
Solved
Convert input data from Date Time to just Date

Good morning!

I am using an input field to populate Creation date which is a System entity, reason why I cannot change it to be just Date on the input field. Any suggestion on how I can change this setting? It doesn't make much sense for me to have the time at which the user was created.

2023-03-13 10-26-05
Sriyamini
Solution

Hi Helga,

I attached the OML regarding your issue. You can refer the demo 

Demo

Thanks,

Sriyamini J


Systemenity.oml
2025-02-13 09-42-38
Helga Afonso

Thanks! This solved my issue :)

2022-12-22 10-00-39
Beatriz Sabino

Hi Helga.

You can use the action DateTimeToDate.

Hope this helps.

2025-04-15 10-28-35
Dhanasingh Dennison

Hi @Helga Afonso 

you can use the in built function, like mentioned below:

DateTimeToDate(Entity.DateTimeAttribute)

in displaying the creation date., this might help.

Thanks,

Dhanasingh Dennison.


2026-02-16 05-51-10
Sahana K

Hi,
1.FormatDateTime(CreationDate, "yyyy-MM-dd")
2.Create a Local Variable of type Date.
3.Bind it to the input field.
4.DateToDateTime(UserInputDate)

Thanks,
sahana


2025-02-13 09-42-38
Helga Afonso

where do I apply steps 1 and 4?

2026-02-16 05-51-10
Sahana K

Hi,

You can use this one

FormatDateTime(Entity.CreationDate, "yyyy-MM-dd")

2022-12-22 10-00-39
Beatriz Sabino

When creating a record in your entity, on the DateTime attribute apply the action DateTimeToDate(DateTimeAttribute) 

2025-02-13 09-42-38
Helga Afonso

Since User is a System entity I cannot change it


2022-12-22 10-00-39
Beatriz Sabino

From what I understand, you're trying to save a new user in the User entity. 

Since, as you mentioned, this entity cannot be modified, you'll need to store it as a DateTime.

 For auditing purposes, having the user creation attribute as a DateTime can be useful. 

2026-02-16 05-51-10
Sahana K

Hi,
1.Create a local variable (CreationDateFormatted) of type Date.
2.Set its value 
CreationDateFormatted = DateTimeToDate(User.CreationDate)

3.Bind the input field to CreationDateFormatted 
Thanks,
sahana

2025-02-07 09-54-44
Sivasakthi Munusamy

Hi @Helga Afonso 

can you pls refer the below attached oml, If it helps.

Thanks,

Sivasakthi

DateTimeToDateScreen.oml
2021-11-12 04-59-31
Manikandan Sambasivam

Hi,

Please try FormatDateTime 


2020-07-29 19-08-40
Sanjay Kumar Sahu

Hi @Helga Afonso,

I understand your problem. You want to display Creation_Date of User entity(probably) to an input field in your screen in simple date format but this is a system entity having DataTime format so mapping directly your aggregate attribute to Input field is not going to work. You need to map a local variable to your Input field first(snap1) and that local variable you need to update on OnAfterFetch event of that aggregate like below:

Note: Creation_Date is of Text data type because FormatDateTime() output in text format.

This will be your OnAfterFetch event:


Cheers

2023-08-29 05-15-27
Navdeep Gupta

Hi Helga,
Instead of modifying the system entity itself, you can format the value when displaying it in the input field. If you're using OutSystems, you can apply formatting like this:

FormatDateTime(CreationDate, "yyyy-MM-dd")

This will ensure that only the date is shown while the time part remains stored in the system.

2023-03-13 10-26-05
Sriyamini
Solution

Hi Helga,

I attached the OML regarding your issue. You can refer the demo 

Demo

Thanks,

Sriyamini J


Systemenity.oml
2025-02-13 09-42-38
Helga Afonso

Thanks! This solved my issue :)

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Helga,

You definitely always should record the time at which a record is created, but of course such an attribute should be auto-filled by the code (ideally in a save wrapper), not entered by the user!

Also, you should consider creating a structure for your input, instead of directly using a system entity, then mapping the attributes of the structure when saving the record.

2014-10-21 20-15-17
Alberto Ferreira

Hello Helga

May I suggest using an option with a large set of functions to deal with dates and datetimes:

https://www.outsystems.com/forge/component-overview/16516/dateplus-o11


Thanks

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.