1

Format date in file snippet

When using :

%(created|date)s

I get

"2024-09-23"

when instead use:

%(created|datetime)s

I get

09/23/24 16:15:33

How can I get rid of the quotation marks in the "date" example above?

simbalsyd's avatar
46
simbalsyd
asked 2024-09-23 09:19:01 -0600
Wingware Support's avatar
4.2k
Wingware Support
updated 2024-09-23 16:02:42 -0600
edit flag offensive 0 remove flag close merge delete

Comments

Do you have an environment variable __DATE_FORMAT__ defined? If so, it may be that it contains the quotes. The default if this env is not set is to use %x, and in any case we're calling time.strftime() with that format, so time.strftime('%x') by default. I did just test this here and works (no quotes added) with Wing 10.0.6 using %(created|date)s. It vaguely sounds like a bug we once fixed, but I didn't find it in the changes for anything since Wing 7 so my memory of that may be from a long time ago.

Wingware Support's avatar Wingware Support (2024-09-23 09:31:04 -0600) edit
add a comment see more comments

1 Answer

1

You are completely right. For some reason I have the following environment variable

__DATE_FORMAT__="%Y-%m-%d"

I am not sure why I have it. I changed it to

__DATE_FORMAT__=%Y-%m-%d

Now it works as I want it.

I have a feeling that it used to not add the quotation marks but for me it doesn't matter now.

Thanks
/Anders

simbalsyd's avatar
46
simbalsyd
answered 2024-09-23 12:26:41 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer