Skip to content

Question: format('SQL') #437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vanodevium opened this issue Mar 29, 2025 · 3 comments
Closed

Question: format('SQL') #437

vanodevium opened this issue Mar 29, 2025 · 3 comments

Comments

@vanodevium
Copy link
Contributor

Is there any chance to format DateTime as string in SQL ISO format?

Maybe spacetime already can do this, but I didn't found.

I definitely understand that I can manually write the format I need, but it would be convenient to have a constant method to generate it.

Anyway thanx for this awesome library!

@vanodevium
Copy link
Contributor Author

console.log(new Date().toISOString().replace("T", " ").slice(0,19));
console.log(spacetime.now().format('{iso-short} {hour-24-pad}:{minute-pad}:{second-pad}'));

@spencermountain
Copy link
Owner

oh hey, good idea.
Yeah is it simply a ISO with a space instead of the T character?
happy to add this.
If you (or anyone) wants to beat me to it, it sounds like an addition for here and then a update to docs/types.
cheers

@spencermountain
Copy link
Owner

released as 7.9.0 - thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants