Select to view content in your preferred language

remove time from date in Arcade?

3417
5
07-15-2021 08:53 AM
Labels (1)
anonymous55
Frequent Contributor

Hello,

I am trying to label symbols in AGOL and I wrote this arcade but I can't remove time from date?
any suggestion.

"Owner of Scooter" + " : "+
DomainName($feature,"vehicle_company")
+" Inspection Date : "+
Date($feature.CreationDate)

AhmadrezaMaddi_0-1626364286993.png

 

 

0 Kudos
5 Replies
jcarlson
MVP Esteemed Contributor

Try converting the date to a string using the Text function.

Text($feature.CreationDate, 'Y-MM-DD')

 

- Josh Carlson
Kendall County GIS
0 Kudos
anonymous55
Frequent Contributor

This one doesn't give me the date

AhmadrezaMaddi_0-1626365069238.png

 

0 Kudos
jcarlson
MVP Esteemed Contributor

The function is "Text", not "Date".

- Josh Carlson
Kendall County GIS
RandyMcGregor3
Frequent Contributor

Is there a way to get a 'Date' value that does not have time included? 

Thank you,

Randy McGregor

Scott_Sambell
Frequent Contributor

This "removes" the time from a date field. (In actual fact it just resets it to 12:00:00pm but it serves the same purpose).  Remember to put a '-1' after the month because January is 0.

var day = text($feature.DateOfRecord, 'DD')
var month = text($feature.DateOfRecord,'MM')
var year = text($feature.DateOfRecord,'YYYY')
var notimedate = date(year,month-1,day)
return notimedate

Scott
0 Kudos