Hi all,
I would like to have the month of a given time not as an integer, but as a string. So if the integer would be 1, I would like to get (or convert) to “January”. Is this somehwo possible?
Thanks,
Oliver
Hi all,
I would like to have the month of a given time not as an integer, but as a string. So if the integer would be 1, I would like to get (or convert) to “January”. Is this somehwo possible?
Thanks,
Oliver
Found out one possible solution by myself using conditionals:
toString = (tables=<-) => tables
|> map(fn: (r) => ({
r with _time:
if date.month(t: r._time) == 1 then "Januar"
else if date.month(t: r._time) == 2 then "Februar"
else if date.month(t: r._time) == 3 then "März"
else if date.month(t: r._time) == 4 then "April"
else if date.month(t: r._time) == 5 then "Mai"
else if date.month(t: r._time) == 6 then "Juni"
else if date.month(t: r._time) == 7 then "Juli"
else if date.month(t: r._time) == 8 then "August"
else if date.month(t: r._time) == 9 then "September"
else if date.month(t: r._time) == 10 then "Oktober"
else if date.month(t: r._time) == 11 then "November"
else "Dezember"
})
)
Hi @Sparx82,
I believe this would be the best approach. If you have an arbitrary value representing your months that will not change then this mapping makes sense. If you wanted to extract the month from the _time field this is also possible.
I have a similar demand. I want to have a different Time and Date format in the Dashboard Table.
There are a lot of different formats to choose, but unfortunately all this formats includes the Timestamp.
If you want to habe a table that shows some values for every month, it is not useful to have also the time information.
There is no date/time format without the timestamp
I would like to have a format like
It seems there was a possibility for custom time formats in older Chronogaf version?
I am using the new InfluxDB 2.0 package
My actual workaround is like this
|> map(fn: (r) => ({
r with
_kosten: float(v: r._value*0.33),
_tag: if date.weekDay(t: r._start) == 1 then string(v: date.monthDay(t: r._start)) + "." + string(v: date.month(t: r._start)) + " - Montag"
else if date.weekDay(t: r._start) == 2 then string(v: date.monthDay(t: r._start)) + "." + string(v: date.month(t: r._start)) + " - Dienstag"
else if date.weekDay(t: r._start) == 3 then string(v: date.monthDay(t: r._start)) + "." + string(v: date.month(t: r._start)) + " - Mittwoch"
else if date.weekDay(t: r._start) == 4 then string(v: date.monthDay(t: r._start)) + "." + string(v: date.month(t: r._start)) + " - Donnerstag"
else if date.weekDay(t: r._start) == 5 then string(v: date.monthDay(t: r._start)) + "." + string(v: date.month(t: r._start)) + " - Freitag "
else if date.weekDay(t: r._start) == 6 then string(v: date.monthDay(t: r._start)) + "." + string(v: date.month(t: r._start)) + " - Samstag"
else string(v: date.monthDay(t: r._start)) + "." + string(v: date.month(t: r._start)) + " - Sonntag"
}))
Result is what I wanted, but…
…this end up in very slow performing queries
Is there any smarter way to get custom date and time formats in dashboard tables?
Or where can I vote for some improvements?
thanks and regards
Sven
@dewenni There are a feature feature requests / issues related to this. Feel free to comment and upvote these: