Questions tagged [localtime]

Calendar time expressed relative to the user's local timezone.

Calendar time expressed relative to the user's local timezone.

461 questions
5
votes
1 answer

What does time_since_epoch() actually represent in a std::chrono::local_time?

I'd like to serialize a std::chrono::local_time by sending it's time_since_epoch().count() value. My question is how is a non-C++ receiver supposed to interpret that value? Is it the actual number of ticks since the epoch at local midnight…
Emile Cormier
  • 28,391
  • 15
  • 94
  • 122
5
votes
2 answers

Rails 'local-time' gem not running JS

I'm trying to use the local-time gem by Basecamp. Following the Readme, I added //= require local-time to my app/assets/config/manifest.js, which now looks like this: //= link_tree ../images //= link_directory ../stylesheets .css //= require…
Dennis Hackethal
  • 13,662
  • 12
  • 66
  • 115
5
votes
5 answers

How to parse time in any format with LocalTime.parse?

I am having trouble using java's LocalTime to parse a string with hours, minutes, and seconds. LocalTime t = LocalTime.parse("8:30:17"); // Simplification This throws the following exception: Exception in thread "main"…
Yury
  • 69
  • 1
  • 7
5
votes
2 answers

How to compare time in Java LocalTime?

Given two LocalTime parameters in Java, I want to be able to compare the two times and see if they are equal (the same time). How would I do this?
FallonXay
  • 97
  • 1
  • 1
  • 3
5
votes
7 answers

How Do I Get Yesterday's Date In C?

I am wanting to get yesterday's date into a char in the format: YYYYMMDD (with no slashes dots etc.). I am using this code to get today's date: time_t now; struct tm *ts; char yearchar[80]; now = time(NULL); ts =…
baxterma
  • 811
  • 1
  • 11
  • 22
5
votes
3 answers

How to differentiate when "second field" is missing in LocalDateTime

I am given LocalDateTime object created from String. I want to check whether that original string has "seconds" parameter or not. My two inputs are: String a = "2016-06-22T10:01"; //not given String b = "2016-06-22T10:01:00"; //not…
Pratik Kumar
  • 81
  • 10
5
votes
2 answers

Adjust LocalTime according to ZoneId

Given a LocalTime in a given ZoneId, how can I find the adjusted LocalTime on UTC? I am looking for something similar to .atZone from LocalDateTime, but couldn't find anything. I suspect I can use it with atOffset, but I don't really understand how…
Matheus208
  • 1,289
  • 2
  • 13
  • 26
5
votes
2 answers

.Net DateTime with local time and DST

I'm afraid I don't really understand how .Net's DateTime class handles local timestamps (I live in Germany, so my locale is de_DE). Perhaps someone can enlighten me a bit ;-) The DateTime constructor can be called with year, month etc. parameters.…
Stefan
  • 1,036
  • 10
  • 32
5
votes
1 answer

How to get TimeZone wise local time using moment.js

i am working with two js library to get browser timezone id and browser local time
Mou
  • 15,673
  • 43
  • 156
  • 275
5
votes
1 answer

DateTime to LocalDate (NodaTime)

I have a DateTime that needs to be converted to a NodaTime LocalDate. Can this be done? I have this: DateTime modifiedDate = File.GetLastWriteTime(file); And I want this: LocalTime modifiedDate = File.GetLastWriteTime(file); But it looks like …
user2475310
  • 733
  • 4
  • 13
  • 19
5
votes
1 answer

Convert between date/time and time-stamp without using std library routines

I am trying to implement in C two simple convertors, date/time to time-stamp and vice-versa, without any dependencies on time library routines (such as localtime, mktime, etc, mainly due to the fact that some of them are thread-unsafe). I have…
barak manos
  • 29,648
  • 10
  • 62
  • 114
5
votes
1 answer

How to configure IIS7 Advanced Logging rollover by local time?

How to configure IIS7 Advanced Logging rollover by local time? In options I set daily schedule (see picture http://gyazo.com/05843b6e29d51f21ee7ed2d6aa4d5157). But IIS create new log file using UTC time, not local time.
Alex Sedow
  • 357
  • 2
  • 17
5
votes
3 answers

How to go back months in Perl taking account of different days in month?

I was wondering if there is an in-built Perl function that adjusts the date if you take a month from it. E.g. if date is the 31st, it will adjust to be the end of the previous month if it doesn't have 31 days. I would just change it to 30th easily…
dgBP
  • 1,681
  • 6
  • 27
  • 42
4
votes
2 answers

Is there a way to change TimeZone for a request in C# (ASP.NET MVC3)?

Is here a way to change timezone setting for a request, for example, at Application_AcquireRequestState then for the whole request, no matter when I use Datetime.ToLocalTime (or new Datetime() etc), a local time version will be shown to current…
Eric Yin
  • 8,737
  • 19
  • 77
  • 118
4
votes
4 answers

How to find all Instants which correspond to the given LocalDateTime and ZoneId?

When converting Instant to LocalDateTime it may happen that several different Instants are converted into the same LocalDateTime. Eg. in time zones with day light saving time. My question is whether it's possible to write a general function which…
Radek Micek
  • 447
  • 2
  • 9