datetime-format

Format date time JavaScript

瘦欲@ 提交于 2019-11-29 08:04:19
How to format date and time like this in JavaScript ? March 05, 2012 @ 14:30 (UTC - 9:30) I use this code to calculate EST time : function getDate() { var now = new Date(); var utc = now.getTime() + (now.getTimezoneOffset() * 60000); return new Date(utc + (3600000 * -4)); } I use the date-time-format that Tats recommended because doing it manually is a huge PIA. var yourDate = dateFormat(getDate(), "mmmm dd, yyyy @ HH:MM) + "(UTC -9:30)"; Keep in mind this isn't Daylight Savings aware.. and you are asking for UTC -9:30 in your format, but your function converts to -4. Also, I believe that now

What does CCYYMMDD date format mean?

拈花ヽ惹草 提交于 2019-11-29 05:29:02
I want to speak to a soap service that has a date parameter which is required to be the CCYYMMDD format. What is its definition? It's just another way of writing yyyyMMdd . The CC part represents the century, while YY is the two-digit year. So instead of having year 2014, you can use century 21, year 14 yyyy CC YY 2014 -> 21 14 Update: My initial take on this was that yyyy:2014 would translate to ccyy:2014 . Due to lack of documentation, that stuck for a while. Doing further research, I arrived at the conclusion that yyyy:2014 is actually ccyy:2114 It means yyyyMMdd , as in year (4 digits),

JavaScript datetime parsing [duplicate]

送分小仙女□ 提交于 2019-11-29 04:06:28
Possible Duplicate: How can I convert string to datetime with format specification in JavaScript? I have a json response which contains a hashmap like; {"map":{"2012-10-10 03:47:00.0":23.400000000000002,"2012-10-10 03:52:00.0":23.3,"2012-10-10 03:57:00.0":23.3,"2012-10-10 04:02:00.0":23.3,"2012-10-10 04:07:00.0":23.200000000000003,"2012-10-10 04:13:00.0":23.1,"2012-10-10 04:18:00.0":23.1,"2012-10-10 04:23:00.0":23.0,"2012-10-10 04:28:00.0":23.0,"2012-10-10 04:33:00.0":23.0,"2012-10-10 04:38:00.0":22.900000000000002,"2012-10-10 04:43:00.0":22.8,"2012-10-10 04:48:00.0":22.8,"2012-10-10 04:53:00

“asp-format” not applied to tag helpers

喜欢而已 提交于 2019-11-29 02:18:38
问题 I'm facing a problem using "asp-format" tag with taghelper element in my mvc 6 project. The idea is to format a date input element this way: <input asp-for="StartDate" asp-format="{0:dd/MM/yyyy}" /> This "StartDate" property is in my model, declared this way: public DateTime StartDate {get; set; } For a strange reason, this element is never formatted, and is presented always like this: ---> 02/29/2016 00:00:00 So I created a viewmodel class and defined a property to hold the entire person

How to serialize and deserialize Java 8's java.time types with Gson? [closed]

可紊 提交于 2019-11-29 01:13:23
I'm using GSON to serialise some object graphs to JSON. These objects graphs use the new Java 8 java.time entities ( ZonedDateTime , OffsetDateTime , LocalTime etc). I've found a library for Joda Time serialisers here - is there an equivalent library for the JDK java.time classes? ( This person had no luck with their efforts to use GSON with java.time - and their question remains unanswered). There's a Java 8 library here: https://github.com/gkopff/gson-javatime-serialisers Here's the Maven details (check central for the latest version): <dependency> <groupId>com.fatboyindustrial.gson-javatime

How to change format (e.g. dd/MMM/yyyy) of DateTimePicker in WPF application

こ雲淡風輕ζ 提交于 2019-11-28 19:36:57
I want to Change the Format of date selected in DateTimePicker in WPF Application Fernando García I was handling with this issue rencetly. I found a simple way to perform this custom format and I hope that this help you. First thing that you need to do is apply a specific style to your current DatePicker just like this, in your XAML: <DatePicker.Resources> <Style TargetType="{x:Type DatePickerTextBox}"> <Setter Property="Control.Template"> <Setter.Value> <ControlTemplate> <TextBox x:Name="PART_TextBox" Width="113" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Text="

How to get an isoformat datetime string including the default timezone?

瘦欲@ 提交于 2019-11-28 17:21:09
问题 I need to produce a time string that matches the iso format yyyy-mm-ddThh:mm:ss.ssssss-ZO:NE . The now() and utcnow() class methods almost do what I want. >>> import datetime >>> #time adjusted for current timezone >>> datetime.datetime.now().isoformat() '2010-08-03T03:00:00.000000' >>> #unadjusted UTC time >>> datetime.datetime.utcnow().isoformat() '2010-08-03T10:00:00.000000' >>> >>> #How can I do this? >>> datetime.datetime.magic() '2010-08-03T10:00:00.000000-07:00' 回答1: Something like the

DateTime.ToString() format that can be used in a filename or extension?

半城伤御伤魂 提交于 2019-11-28 16:46:45
I want to add a timestamp to filenames as files are created but most of the DateTime methods I've tried output something with spaces and slashes. For instance: Debug.WriteLine(DateTime.Now.ToString()); // <-- 9/19/2012 1:41:46 PM Debug.WriteLine(DateTime.Now.ToShortTimeString()); // <-- 1:41 PM Debug.WriteLine(DateTime.Now.ToShortDateString()); // <-- 9/19/2012 Debug.WriteLine(DateTime.Now.ToFileTime()); // <-- 129925501061462806 ToFileTime() works but is not exactly human-readable. How can I format the output to a human-readable timestamp with date and time that can be used in a filename or

Exception when trying to parse a LocalDateTime

↘锁芯ラ 提交于 2019-11-28 14:08:30
I am using the following timestamp format: yyyyMMddHHmmssSSS The following method works fine: public static String formatTimestamp(final Timestamp timestamp, final String format) { final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format); return timestamp.toLocalDateTime().format(formatter); } And, when I pass in a Timestamp with that format string, it returns, for example: 20170925142051591 I then require to map from that string to a Timestamp again, essentially the reverse operation. I know that I can use a SimpleDateFormat and its parse() method, but I'd prefer to stick to

Convert number of seconds into HH:MM (without seconds) in Java

﹥>﹥吖頭↗ 提交于 2019-11-28 12:46:10
问题 I'm aware that you can use DateUtils.formatElapsedTime(seconds) to convert a number of seconds into a String with the format HH:MM:SS . But are there any utility functions that let me perform the same conversion but without the seconds? For example, I want to convert 3665 seconds into 1:01 , even though it's exactly 1:01:05 . In other words, simply dropping the seconds part. Would strongly prefer an answer that points to a utility function (if one exists) rather than a bunch of home rolled