I am using embedded Cassandra 3.11.7 with springboot.
I live in South Korea which uses KST time which is UTC + 9.
So I'm looking for a way to set Cassandra timezone to kst or UTC+9.
When inserting the actual Cassandra, it is stored as utc that is -9 hours longer than the current time, so it is not possible to get an accurate value when looking up the date.
So I'm looking for a way to set the Cassandra timezone.
I have a cassandra configuration and webFlux.
@Configuration
@EnableReactiveCassandraRepositories
@PropertySource(value = "file:${sf1.manager.path}/conf/cassandra.properties", ignoreResourceNotFound = true)
public class CassandraConfig extends AbstractReactiveCassandraConfiguration {}
thank you.
Caveat: I’m not a Cassandra user.
According to the documentation, Cassandra stores time stamps in UTC.
There should be no need to set the default time zone of the Cassandra server or its JVM. Simply exchange values in UTC, having an offset of zero hours-minutes-seconds. Use the java.time classes only, never the terrible legacy classes.
Capture the current moment in UTC.
Generate text in standard ISO 8601 format. The
Zon the end means an offset of zero hours-minutes-seconds from UTC, and is pronounced “Zulu”.Parse such a string.
If using JDBC, convert to the
OffsetDateTimeclass.Retrieval.
Adjust into a time zone to view that moment in the wall-clock time of your region.
The 2-4 letter codes such as
KST,CST,ISTare not actual time zones. They hint at the time zone, and indicate if Daylight Savings Time (DST) is in effect or not. These pseudo-zones are not standardized, and are not unique! Use these only for localized presentation to the user, never for data storage nor data exchange.Real time zones are named in format of
Continent/Regionsuch asAsia/Seoul.Generate strings, automatically localized using
DateTimeFormatter.ofLocalizedDateTime.