Return to Solutions Overview <-

Create a beautiful text string from a Unix Time Stamp

(Still under development as of March 15th 2023)

// Create time string
function createTimeString( unixTimeStamp )
{
    // Local variables
    let date = new Date( unixTimeStamp ),
        month = date.toLocaleString('default', { month: 'long' }),
        day = date.getDate(),
        year = date.getFullYear(),
        timeString = `${ month } ${ day }${ retrunNth( day ) }, ${ year }`

    // Return formatted string
    return timeString
}

// Return ending of day
function retrunNth( day )
{
    if ( day > 3 && day < 21 ) return "th"
    switch (day % 10)
    {
        case 1:  return "st"
        case 2:  return "nd"
        case 3:  return "rd"
        default: return "th"
    }
}

Call something like createTimeString( 1669120494952 ) and you get a nice string that you can use anywhere in your project.

FAQs

You still have an open question about BMG.studio and how we operate. Chances are good that you will find what you are looking for here:

Why does this FAQ exist?

Well. As of Wednesday, March 15th 2023, I think this component looks really cool.

Can I clone this FAQ component?

Yes. Yes you can. You can do so -> here <-

Still have questions?

It's okay to reach out. Use either email or our calendar tool