Is possible to create own time format for day with 26 hours?


Is possible to create own time format for day with 26 hours ?

Typical time :
julia> x=Dates.DateTime(“20140529 230000”, “yyyymmdd HHMMSS”)

In my system day starting at 02:00:00 and end of day is at 25:59:59.:
How it us.write in Julia Time system ?
My example:
julia> x=DateTime(“20140529 255959”, “yyyymmdd HHMMSS”)
ERROR: ArgumentError: Hour: 25 out of range (0:23)
in DateTime(::Int64, ::Int64, ::Int64, ::Int64, ::Int64, ::Int64, ::Int64) at .\dates\types.jl:149
in DateTime(::Base.Dates.Year, ::Base.Dates.Month, ::Base.Dates.Day, ::Base.Dates.Hour, ::Base.Dates.Minute, ::Base.Dat
es.Second) at .\dates\types.jl:172
in DateTime(::String, ::String) at .\dates\io.jl:258




Your best bet would probably be defining a new type, with the relevant constructors (parsers) and operations. You can probably reuse a lot of code from the implementation in Base (which is pretty lightweight anyway).

Alternatively, writing a very, very thin wrapper around DateTime that just parses and displays with an offset may be an easy solution, provided that your day has 24 hours (contrary to what you say above), just with an offset.


Julia Version 0.5.0
Yes , day have a 24 h but start at :02:00:00
Offset is possible but my solution must be very speed…


If you use an immutable for your struct and make sure that all the operations you defined are type-stable (see Base.Test.@inferred), the offset solution should be nearly as fast as defining a type from scratch.


Paul, forgive me if I am not understanding your correctly.
It seems that you have a day which is 24 hours long. You are located in a timezone which is two hours ahead of UTC.
Why not just use the timezone?{}

"Returns a DateTime corresponding to the user’s system time including the system timezone locale."
How do you use another timezone here?
(For Paul’s purposes translation between the system timezone and UTC is handled)

Actually, thinking about this, for the astronomy community it must be useful to have date and time formats where days are not 24 hours long. How do planetary scientists count dates? I would be interested in the response here from real live planetary scientists!


ps. I have misunderstood this. If Pawel (sorry) is using timezones then the day would be from 02:00 until 02:00 the next day. Would you explain please the reason for having a day extent till 26:00 hours?

pps. I am interested in this because I got quite deep into the Perl DateTime manipulations at one stage. I have never been the same since then.
Grace Hopper famously had a clock in her office which ran backwards. Do we have a GraceHopper time type?


Hi John,
My day have only 24 hours but is starting at 02:00 and is ending at
25:59. On media market f.e. movie watched on the TV at 0:30 in sunday is
reported at 24:30 at saturday before sleep ) ! Its all :slight_smile:

W dniu 2017-09-17 o 09:05, John Hearns pisze:


I don’t know your context, but preprocessing your data (eg just subtract 120min) could be the easiest solution.


Thanks Tamas, it is True:)
W dniu 2017-09-17 o 18:56, Tamas Papp pisze: