add an epoch dateTimeFormat mask

Description

It would be very helpful for dateTimeFormat() to have a mask option to return epoch time for a given datetime rather than trying to hunt down the java function or write a UDF that does that. I don't know java (at all). I've been a CF user since the Allaire days. When I want to format a datetime in a specific format, I go to the datetimeformat() function first, and epoch time is just another datetime format. Because java should do most of the heavy lifting for you, it should be quick for you to implement something like the following:

```
if (mask == 'epoch'){
return inputDate.getTime()/1000;
} else if (mask == 'epochMS'){
return inputDate.getTime();
}
```

Please see this thread for more detail, and thank you for all that you do! Lucee is so much better than ACF!: https://dev.lucee.org/t/please-add-a-datetimeformat-mask-that-returns-epoch-time/5921/7

Activity

Zac Spitzer 14 June 2023 at 17:24

updated docs

John Wilson 1 October 2021 at 00:56
Edited

Argh - I thought this was in 5.3.8… I could really use this addition

Pothys - MitrahSoft 15 April 2021 at 11:15

Now lucee accepts "epoch" and "epochms" masks in dateTimeFormat() from the latest build version 6.0.0.83-SNAPSHOT onwards. So I marked this as deployed.

Zac Spitzer 7 April 2021 at 09:39

Pothys - MitrahSoft 16 March 2021 at 13:53

I closed the above PR ( https://github.com/lucee/Lucee/pull/751 ) due to conflict and added a new PR.

Pull Request: https://github.com/lucee/Lucee/pull/1233

Fixed

Details

Assignee

Reporter

Labels

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Fix versions

Affects versions

Priority

Created 2 September 2019 at 23:56
Updated 2 December 2024 at 00:48
Resolved 15 April 2021 at 11:15