468 questions
0
votes
1
answer
64
views
How in python can I transform negative secs into struct time? [duplicate]
I'd like to transform -238204800 seconds to "1962:06:15 00:00:00", using python 3.8.
My code is :
from time import strftime, localtime
secs = -238204800
print(strftime("%Y:%m:%d %H:%M:%...
-1
votes
3
answers
184
views
Migrating from Joda-Time to java.time: How to replace time.toDateTimeToday().getMillis()? [closed]
I'm currently migrating my codebase from Joda-Time to the java.time API (Java 8+).
In one part of my application, I schedule tasks to run at a specific time either today or tomorrow, depending on ...
0
votes
2
answers
111
views
Difference in precision of UTC and Local TIMESTAMP dates inserted with same statement
I have created an ALL SERVER FOR LOGON trigger in my MS SQL Server 2019 Dev Edition to keep track of login activity.
The activity is stored in a database table SYS_UNF_TRAIL that includes the ...
2
votes
2
answers
79
views
Convert the same local time to UTC on different dates, respecting the local DST status
I have several local time points:
import datetime
from zoneinfo import ZoneInfo as zi
wmr = datetime.time(hour=12, tzinfo=zi("GMT"))
ecb = datetime.time(hour=14, minute=15, tzinfo=zi("...
0
votes
1
answer
58
views
Mixed Duration and LocalTime math
First off, NodaTime seems like a really well thought out, full featured package, kudos. Question, maybe I am missing something, but can Duration be mixed with LocalTime in anyway? I need to do some ...
1
vote
1
answer
151
views
LocalTime parse truncating time's second value
I have similar issue to this.There is no solution there and I am not working with JSON mapping.
LocalTime.parse on time string is removing second part. I have put the test code below. Any suggestion?
...
1
vote
0
answers
67
views
How can I calculate local time at different longitudes if I only know which longitudes have a local time of zero?
I have variables in a dataset that give me longitude[:], latitude[:], time[:] and localtime_at_0[time].
localtime_at_0 only tells me which longitudes are experiencing midnight. However, I'd like to ...
0
votes
1
answer
55
views
Getting time in a different time zone using C++
C++ will let me get the local time with std::localtime(), but that presents a problem when I'm using an online compiler whose server is in a different continent. How do I get the time in PST instead ...
0
votes
3
answers
2k
views
How to convert Date from UTC to local time in Angular 16/17
I am getting the date from backend, and the date is stored in UTC format but I want it in local timings or IST
Didn't get anything relevant. You find my code below, datetransform also didn't work
<...
0
votes
1
answer
68
views
How to fix the non-updating clock on a tkinter weather app?
Clock on tkinter doesn't work
I created a weather app, but the clock just constantly stand still the time, how to fix it???
current = datetime.now(home)
real = current.strftime("%d/%m/%Y\n%H:%M:%...
1
vote
1
answer
950
views
Parse a datetime string that has no 'T' separator using java.time
I am trying to parse string "2023-05-10 09:41:00" to LocalTime using java.time library.
When I try LocalTime.parse("2023-05-10 09:41:00", DateTimeFormatter.ISO_LOCAL_DATE_TIME) I ...
0
votes
4
answers
2k
views
Converting UTC to Local Time with daylight saving in Java
I am trying to convert UTC time to local time, including daylight saving.
Localtime (Stockholm), in summer, should be 2 hours ahead of UTC, but when I convert it in Java it only adds one hour.
public ...
3
votes
1
answer
147
views
How to save time (Localtime) from WheelTimePicker on API 24?
I have a project on Jetpack Compose where I need to make a Wheel time picker to choose the time. I found a solution that looked acceptable.
https://github.com/commandiron/WheelPickerCompose
Then I got ...
-2
votes
3
answers
1k
views
Convert Date to UTC DateTime
I have the date 2023-04-03 and wanted to convert it into UTC time with range (start and end of the day)
2023-04-03T00:00:00 -> 2023-04-02T18:30:00z
2023-04-03T24:00:00 -> 2023-04-03T18:30:00z
...
-1
votes
1
answer
137
views
LocalTime truncating trailing 00 values
The original time value stored in my cassandra DB is : 11:43:00.000000000
I am trying to fetch it in my JSON response as : 11:43:00
What I am getting is: 11:43
What I have tried so far in my model ...
2
votes
3
answers
908
views
Is there any date/time function that handles tomorrow's date including carry over into next month?
I have a function that needs to calculate yesterday's, today's and tomorrow's date. I use localtime to get today's date. I add 1 to tm_mday in order to get tomorrow's date. The issue is if the current ...
0
votes
1
answer
686
views
Can't get right time in C with localtime()?
I have used the following code to get time and date in India, but the time i get is not the right time.
#include <time.h>
#include <stdio.h>
int main() {
struct timespec ts;
struct tm ...
2
votes
2
answers
827
views
localtime() giving the wrong date in C
I'm trying to print out the local time on my computer using C' localtime() function;
The default format of my locale is mm/dd/yyyy, so
The expected output is: 03/04/2023 12:51:43
But I get: 04/02/2023 ...
1
vote
1
answer
163
views
Is there a way to set alarm in android with local date and local time?
I am building a Calendar app to save events, show them and edit them with DatabaseHelper. I want to add alarm to these events but every I can find only setting alarm with Calendar import library. I ...
0
votes
1
answer
166
views
How to convert timestamp, depends on user timezone?
From server I'm getting timestamp like this: " 2022-12-21 16:47:10 ". And I want to convert this time to local time zone, depends on client. E.g. 16:47:10 in Poland was 10am in US. Any ideas ...
0
votes
1
answer
103
views
How to get the current time in a different city in C? [duplicate]
I'm writing a server in C that is meant to get a request over UDP for the time in either:
Doha, Prague, New York or Berlin.
How can I produce the right response?
I tried looking into the localtime() ...
1
vote
1
answer
588
views
Why is Java LocalTime 01:32:13.283256 stored as time 00:32:13 in database? 1 hour behind
Why is the value set to 1 hour behind?
If Europe/Dublin or Europe/London is same offset as UTC, why is the value in db different to originating JVM value?
JVM: Europe/Dublin - TimeZone.getDefault()....
2
votes
3
answers
115
views
Java int formating?
I want the user to input hours and minutes for a Local.Time from 00 to 23 and from 00 to 59, I scanned this as an int. It works but for values from 00 to 09 the int ignores the 0 and places then as a ...
-2
votes
1
answer
286
views
HQL query: filtering LocalDateTime property by LocalTime
I have a problem to create a query which gives back all value where time is between two parameter.
How can I get back those works where endTime time part is between the given LocalTime-s?
public class ...
1
vote
1
answer
514
views
Host timezone not reflect on spring-boot docker container
I'm trying to set a localtime to my docker container as the same as my localtime locally to use on a spring-boot application when save a data.
spring-boot app:
...
cpoWorkflowExecution.setStartDate(...
-1
votes
1
answer
53
views
Comparing LocalTime returns true, even tho debugger evaluates to false [closed]
So, I am currently working on a function that checks if a given LocalTime is inside a range. All good, and the equivalent for LocalDateTime works without an issue.
So, my code right now looks like ...
0
votes
0
answers
263
views
12-Hour Clock Displaying 00 hours, when incremented after 12. 24-Hour Clock ignoring increment limitation beyond 23. How can I fix this issue?
#define _CRT_SECURE_NO_WARNINGS //Suppresses warnings that will block the complier.
#include <iostream>
#include <iomanip>
#include <string>
#include <Windows.h>
#include <...
1
vote
1
answer
152
views
How to get the duration time
I have departure time - 02:00, arrival - 06:15, and on the way - "on the way 4h 15m".
I want to calculate whether the travel time is counted correctly
HTML
<div class="wl-...
0
votes
1
answer
359
views
localtime() returns a pointer to a structure with uninitialized members
char datetime[DATETIME_LEN];
time_t timer;
struct tm* tm_info;
timer = time(NULL);
tm_info = localtime(&timer); // debug: tm_info: 0xcccccccccccccccc {tm_sec=??? tm_min=??? tm_hour=??? ...}
if (...
1
vote
0
answers
42
views
How to change a past date from local Eastern time to Central European Time while accounting for daylight savings? [duplicate]
I am new to C# so please excuse me if the question is too simple, I tried the code below and it didn't work
I tried:
//-- Local Time I want to convert
DateTime eventDate1 = new DateTime(2020, 03, 21, ...
4
votes
2
answers
2k
views
Correct way to get the duration between a time strings and current time in Kotlin
What is the correct and easiest way to get the duration between a time string and actual time in Kotlin?
I have following time strings (timeStr): "18:00:00"
At the end I like to have a ...
0
votes
0
answers
68
views
AWS RDS Timezone issue (Jamaica)
We have encountered a problem where we need to use local time zones on application servers and the RDS database (Oracle, MySQL, Postgre). Jamaica uses UTC-5 and never observes DST, while the rest of ...
0
votes
1
answer
707
views
Resolving the issue of unsafe function deprecation and misusing time-getting methods like std::ctime() or std::localtime() to get local time in C++
I'm building a simple small program for fun, to kill time and learn something. I simply want my program to display local time (I live in Buffalo, NY, so I'm in ET). I put together an ostensibly ...
-2
votes
2
answers
920
views
How to convert UTC dates that are stored in MSSMS to local time in my program when they are called
So this Publish time is a datetime in UTC that is retrieved from my database, it is currently in UTC and I need to change it to local time and then display the local time on my LineChartDataSet
1
vote
2
answers
3k
views
Why getLocalTime implementation needs delay
I noticed a weird behavior of my application on an ESP32.
After some "debugging" I think the issue is due to this function:
bool getLocalTime(struct tm * info, uint32_t ms)
{
uint32_t ...
1
vote
1
answer
1k
views
How to get local time in seconds (unix epoch)?
I am trying to get the local time in seconds (unix epoch) when a timezone is set.
For e.g.
1643371200 is 2022-01-28 12:00:00 with UTC0
this can be read via gettimeofday(tv, NULL) as seconds with the ...
3
votes
2
answers
562
views
Does localtime return a heap allocated tm*
As you know the <time.h> standard header defines the struct tm and a function called localtime.
Does localtime make a heap allocation?
Or is it allocated in the stack?
It returns a pointer but ...
0
votes
0
answers
34
views
DateTimeFormat annotiation not working for location time
I am using following to get HH:MM format for time in my pojo:
@DateTimeFormat(pattern = HTConstants.TIME_FORMAT)
private LocalTime checkOutTime;
But it returns HH:MM:SS. Any other ways to do ...
0
votes
0
answers
275
views
How to use MyBatis to map MSSql Time to Java LocalTime type
I am having DB chema with Time type:
[localTime] [TIME],
I am having a POJO with field
LocalTime localTime;
Now, I am using mybatis to map checkout_time to LocalTime localTime using:
<result ...
1
vote
1
answer
935
views
pandas DataFrame.plot: how do I get UNIX timestamps on the x-axis as date/time in my local timezone?
I'm trying to plot some time series data whose source times are UNIX timestamps (seconds since 1970) and I want to see date/times in my local timezone on the x-axis. I'm using the DataFrame.plot ...
-3
votes
1
answer
78
views
What is the Signature of LocalTime datatype in Java to create objects with it ? int/string cannot be applied to LocalTime Error [closed]
This is in my constructor in class Office.
public Office(String name, String location, LocalTime openingTime, LocalTime closingTime) {
this.name = name;
this.location = location;
...
0
votes
0
answers
89
views
Why asctime(localtime(<ime)) function does work on gcc 4.8.4 properly and cause problem with gcc 9.4.0
ltime=time(NULL);
sprintf(buffer,"\n%sTwo matrices of size %dx%d have been read. The number of threads is %d \n",asctime(localtime(<ime)),side_Array,side_Array,val_M);
write(...
0
votes
2
answers
540
views
How do I convert UTC DateTime to local DateTime without ending up with a different format
I have specific DateTime values in this format 'YYYY-MM-DDThh:mm:ss.ms' (e.g. '2022-05-10T13:44:00.0000000') and I need to convert them to local DateTime (which is UTC+2 for me) without changing the ...
0
votes
1
answer
482
views
Java LocalTime value is not correct, when query is using hibernate
The question is when I save the value between "12:00 AM"~"8:15 AM" in DB, and query the data using hibernate, it will automatically adding 5 mins.
I have tried using hibernate ...
0
votes
1
answer
185
views
Can I increase the value of every item in the list by 1 in every 1 minute in Python?
I would like to do it by constantly checking local time in my computer. Is there also a way to do it by NOT checking with time of local machine?
I want to also program not execute certain statements ...
0
votes
1
answer
394
views
Chaining localtime and mktime in jq
If I do:
$ jq -cn 'now | localtime'
[2022,3,12,21,9,29.65448808670044,2,101]
It correctly gives the "broken down time" representation of current local time.
But If I do:
$ jq -cn 'now | ...
0
votes
1
answer
1k
views
How to convert an UTC datetime string into a local datetime in Dart?
I got this value from an API 2022-03-15T02:33:53.488427, it is a string which represents a UTC timestamp, my current zone time is UTC-5, I'm trying this code:
createdAt = DateTime.tryParse('2022-03-...
0
votes
1
answer
808
views
Java Duration Class, cannot resolve to a type
I am trying to find the difference in time between two LocalTime objects in HH:MM:SS format and my duration object is giving me the error Duration.between cannot be resolved to a type. The between ...
2
votes
2
answers
269
views
How to specify time after daylight saveing time shift in Java
Using the following code:
class Test {
public static void main(String [] args) {
LocalDate date = LocalDate.of(2018, 11, 4);
LocalTime time = LocalTime.of(1, 59);
...
0
votes
0
answers
29
views
How to convert LocalTime to RegularTimePeriod? [duplicate]
I am plotting a linechart with JFreeChart. X axis of the linechart should be time and I want to get this time as a string like "08:20:20,19". When I am trying to convert LocalTime to ...