Message Boards Message Boards

0
|
5083 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Convert dates on Timeline?

Posted 7 years ago

Dear All,

Please can you help. Why are 'DateFormat' not properly working on the 'Timeline' output?

The date output should be "Day", "Month" and "Year". But only work on the first output '04/09/2004' but not on the following two dates. Why?

Please can you help. Thanks. ....Jos

DateObject[DateFormat -> {"Day", "/", "Month", "/", "Year"}] ;
TimelinePlot[
 {{
   Labeled[{2004, 04, 09}, Style["Date output OK", Black, Bold, 12]]
   , Labeled[Interval[{{2005, 18, 02}, {2005, 28, 06}}], 
    Style["Date output not OK\nshould be\n18/02/2005 - 28/06/2005", 
     Red, Bold, 12]]
   , Labeled[Interval[{{2012, 01, 08}, {2015, 31, 12}}], 
    Style["Date output not OK\nshould be\n08/01/2012 - 31/12/2015", 
     Red, Bold, 12]]
   }
  }]

enter image description here

POSTED BY: Jos Klaps
3 Replies

Dear Sander, Sean,

Thanks for your quick reply and excellent support.

Best Regards,...Jos

POSTED BY: Jos Klaps

Instead of: DateObject[DateFormat -> {"Day", "/", "Month", "/", "Year"}] ;

You want: SetOptions[DateObject, DateFormat -> {"Day", "/", "Month", "/", "Year"}]

Additionally, you will still have to specify your dates in code as {year,month,day}. DateFormat just affects how dates are displayed. Look at the output of DateObject[{2015, 31, 12}]. It interprets this as 31 months and 12 days beyond the year 2015.

POSTED BY: Sean Clarke

Your first line:

DateObject[DateFormat -> {"Day", "/", "Month", "/", "Year"}] ;

Doesn't do anything…

Have a look at the help of timeline. The default interpretation of a list as a date is {y,m,d,h,m,s}. If you want to specify it differently use e.g. DateObjects:

DateObject[{"2005/18/02", {"Year", "/", "Month", "/", "Day"}}]
POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract