Skip to main content

All Questions

Tagged with
-1 votes
2 answers
2k views

How to get today's timestamp in GMT format - Kotlin

I am using below function to fetch the today's start Timestamp in kotlin- Android. fun getTimeStampForStartOfTheDay(): String { val localDate = LocalDate.now() // your current date time val ...
Jaimin Modi's user avatar
  • 1,631
-1 votes
3 answers
1k views

How can I get Unix Timestamp automatically for every next day?

I need to generate Unix timestamp in milliseconds for every next day at a definite time. For example: today is 4/11/2021 at 09:00:00 then timestamp is: 1636002000000 for tomorrow I need 5/11/2021 at ...
JASIM CHOUHAN's user avatar
0 votes
1 answer
395 views

How to convert epoch timestamp to unix hex timestamp in kotlin?

I am using the following code to get the current epoch time in kotlin. val epochTime = Instant.now().toEpochMilli() Output: 1628769521313 And now the question is how can I convert this timestamp to ...
AndroidDev's user avatar
0 votes
2 answers
152 views

Unix TimeStamp value gets Corrupted

I'm trying to fetch Unix Timestamp value using below snippet but sometimes the value get corrupted like 11030 or 810 something like random number we don,t get actual date public static int ...
Dhinakar Munirathinam's user avatar
1 vote
1 answer
6k views

Conversion of date and time to unix timestamp - kotlin

In timestamp variable, I want to get the timestampt value with the current hour, minute and second. The currentDataTime gives me the time in this format: 2020-08-28 17:18:02. Currently, the timestamp ...
alexandre9865's user avatar
0 votes
2 answers
662 views

Converted unix timestamp with a timezone addition in seconds gives a true local date time on Android emulator but not in real device?

I took a date from a web service in UNIX timestamp. I milltuplied it by 1000L then I added the timezone to it in seconds (also provided by the web service) milltiplied by 1000 to obtain the date ...
Delgado's user avatar
  • 226
0 votes
1 answer
2k views

Sunrise and sunset time are equal after converting

I am trying to convert the millisecond format of time provided by openweathermap but when I convert them the times are just 1minute apart. I have tried converting using Simpledateformat. fun ...
dream projects's user avatar
-2 votes
1 answer
2k views

Why is Android System.currentTimeMillis() not an accurate Timestamp? [duplicate]

I've encountered what appears to be a very unusual bug while developing an android application. The following code in my MainActivity onCreate method: long ts = System.currentTimeMillis(); System....
mimlowe's user avatar
0 votes
2 answers
1k views

Calendar.setTimeInMillis error - why is that? [duplicate]

calendar gets wrong unix time as I got. long millis = 1568814839L; System.out.println(millis); //1568814839 Calendar.getInstance(TimeZone.getTimeZone("Asia/Tashkent")); calendar.setTimeInMillis(...
sardorkun's user avatar
0 votes
0 answers
86 views

Unix time -> string using C on mobile (Android/iOS)

Given a Unix time, as number of seconds since Jan 1st, 1970, how can I convert that to a human-readable string (say, ISO-8601) using C on Android and iOS? The standard library's time.h implementation ...
me--'s user avatar
  • 2,088
1 vote
2 answers
2k views

How get accurate UTC timestamp in android

I do not know which one is right for get UTC time My code is System.currentTimeMillis() for java android Is the result correct for international? Maybe user can change device time and result be ...
Omid Aghakhani's user avatar
-1 votes
1 answer
264 views

Issue: Set Alarm Based on UnixTimestamp

I am trying to set the alarm based on UnixTimestamp, but always the application send alarm before the time i set it , e.g i set alarm on 1563551362 , now the problem is i received the alarm not on ...
aboodyAs's user avatar
0 votes
1 answer
605 views

calendar timeinmillis returns wrong value

With a DatePicker I choose a Date and I need the date and the timestamp from the chosen date: Calendar calendar = Calendar.getInstance(Locale.GERMANY); final DatePickerDialog....
J.Doe's user avatar
  • 187
0 votes
4 answers
1k views

Get unix timestamp exactly 3 years from now

Using Android and Java 8, how can I get unix timestamps back in time? E.g. Exactly 3 years back from now Exactly 2 months back from now Exactly 1 day back from now etc I know I can get current ...
c0dehunter's user avatar
  • 6,512
0 votes
3 answers
3k views

How to find difference between two UNIX time stamp in hours in KOTLIN?

I have two UNIX time stamp and i am using KOTLIN 1) old time - 1534854646 2) current time - 1534857527 Now i want the difference in hours and minutes. val result = DateUtils....
user avatar

15 30 50 per page