Generating Unique Order Numbers - help required with formats of components

TL:DR How do you format a date as its basic number rather than in its “understandable by humans” format?

I’m trying to generate a Unique reference for each order that my Users make. To do this I’m creating a text string that consists of fields UserName, OrderDate/Time, ProductID and then a random 4 digit number glued together with “:Append”. I want it to be one continuous string so it’ll look something (but probably not exactly) like “UserName58252PCW107622”
My thinking is that this will be reliably unique without doing searches in the database to count orders, find the highest number and adding 1 which is my current method and which, I fear, will become slow as order numbers increase.
The trouble I’m having is the formatting of dates in the Order Number so I’m getting, for instance,
“UserName 17th March, 2022 11:15 am PCW107622” where
UserName = User’s Username
Current date and time are formatted in “human”
Product ID = PCW10
Random Number = 7622 (I need this because I don’t want users being able to contact me with spurious order numbers having worked out the rest so it acts like a PIN number on the rest, if that makes sense)
If I can get Bubble to format my date/time as it’s base number rather than “Human date format” it would solve my issue and give me a nice, unique number. If someone can tell me how to achieve this I’d be very grateful as I’ve read many forum posts and the manual and still haven’t found what I need.
Kind regards

Hi there, @joefarrowsmith… if you add the :extract operator after the date, you can extract the UNIX timestamp, and I think that’s what you are talking about, right?

Hope this helps.



That’s magic! Thank you so much. I’d never have found that. This is what I really like about this little journey…learning cool stuff with kind help from people like yourself. Thank you. Have a lovely day.