Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a date/time format that does not have spaces?

Tags:

date

linux

I have a CGI script that will convert a given string to a date/time using the unix date command. I'm looking for a format that can easily be embedded to a URL without the need for escaping with a %20. The client that is building the date/time into the URL does not have a conversion to unix time (seconds since epoch) and does not have a way to convert to the offset from zulu (ISO8601 will not work). However, it is possible to reformat the date/time used to build the URL in many other ways.

Are there any other options to build a datetime in a non-spaced format?

like image 299
User1 Avatar asked Oct 25 '10 20:10

User1


People also ask

How many formats for displaying date and time?

The dates appear as, mm/dd/yyyy in the U.S. and as, dd/mm/yyyy outside the U.S. where mm is the month, dd is the day, and yyyy is the year. The time is displayed as, hh:mm:ss AM/PM, where hh is the hour, mm is minutes, and ss is seconds.

What t means in date format?

The T is just a literal to separate the date from the time, and the Z means "zero hour offset" also known as "Zulu time" (UTC). If your strings always have a "Z" you can use: SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss. SSS'Z'", Locale.US); format.


1 Answers

$ date "+%F-%T"
2010-10-25-16:23:14
like image 194
chrisaycock Avatar answered Oct 12 '22 22:10

chrisaycock