Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
529 views
in Technique[技术] by (71.8m points)

perl - Why does DateTime add a T separator to the timestamp?

My code:

print DateTime->now;

Response:

2012-08-17T20:16:37

Why is there a T? Is there an option I have forgotten?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The T is just a standard (ISO 8601) way to delimit the time. To use a different format, consider using strftime or format_cldr.

For example, to have a space instead, use DateTime->now->format_cldr("YYYY-MM-dd hh:mm:ss").


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...