datetime-format

Display date in dd/mm/yyyy format in vb.net

。_饼干妹妹 提交于 2019-12-09 02:36:44
问题 I want to display date in 09/07/2013 format instead of 09-jul-13. Dim dt As Date = Date.Today MsgBox(dt) 回答1: First, uppercase MM are months and lowercase mm are minutes. You have to pass CultureInfo.InvariantCulture to ToString to ensure that / as date separator is used since it would normally be replaced with the current culture's date separator: MsgBox(dt.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture)) Another option is to escape that custom format specifier by embedding the / within

Converting a string to datetime from “yyyy-MM-dd”

折月煮酒 提交于 2019-12-08 19:01:21
问题 Even though it seems like this question has been asked a bunch of times, I can't seem to find an answer that is specific to my question: I have a variable that is read from an XML file by a C# XML parser. It is a string, and is in the format "yyyy-MM-dd" . I would like to read this variable into our database using SQL , but it needs to be in the proper datetime format in order for me to do this. Unfortunately, I can't find any datetime formats for "yyyy-MM-dd" . Am I missing something? I

Confused by DateTime offsets

爱⌒轻易说出口 提交于 2019-12-08 11:04:27
问题 I'm trying to understand how to interpret GMT offsets so I can work with datetime objects in R. For example, suppose I have a datetime like "2011-04-04 10:45:00 GMT+10" Q1: Should I read that as a Grenwich time and add 10 hours to get the local time? Or is it a local time and I need to subtract 10 hours to get GMT? I always understood it was the latter. Q2: Why does R seem to use the former interpretation? For example foo <- as.POSIXct("2011-04-04 10:45:00", tz="Etc/GMT+10") attr(foo, "tzone"

Show Date-Values on X-Axis in locale depending format ngx-charts / d3

时光总嘲笑我的痴心妄想 提交于 2019-12-08 08:55:55
问题 I have a Webapp using Angular v4.0.1 and ngx-charts (uses d3) v5.1.2 creating a line-chart where the x-axis has date-values. My Problem is that the x-axis does not show the german time-format. So I found out how I can set locale formatting for d3: import * as d3 from "d3"; import * as formatDE from "d3-format/locale/de-DE.json"; import * as timeFormatDE from "d3-time-format/locale/de-DE.json"; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, FormsModule, HttpModule,

Convert different format of DateTime to specific String format

白昼怎懂夜的黑 提交于 2019-12-08 07:31:34
问题 Im Getting System.datetime.now from different Machine .Each system having different datetime format as a mension below 16-Oct-12 7:25:22 PM 16/10/2012 7:10:47 PM [DD/MM/YYYY] 10/16/2012 7:10:51 PM [MM/DD/YYYY] How To convert Different format of DateTime to specific String format ? string sDateTime = DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt"); 回答1: First result of Google search: Custom datetime format strings from MSDN You have to use the line of code you provided explicitly on the other

How to print calendar in monthwise matrix format in Python 3.6?

别等时光非礼了梦想. 提交于 2019-12-08 00:58:26
问题 I have created the Indian National calendar function in Python as below, import calendar import datetime 'Days in Tamil names. first day start from 0-Monday and 6- sunday. similar to ISO format' tamil_day = ('திங்கள்','செவ்வாய்','புதன்','வியாழன்','வெள்ளி','சனி','ஞாயிறு') 'months in Tamil names. first month start from 0-Chithirai and 11-panguni. similar to ISO format' tamil_months = ('சித்திரை','வைகாசி','ஆணி','ஆடி','ஆவணி','புரட்டாசி','ஐப்பசி','கார்த்திகை','மார்கழி','தை','மாசி','பங்குனி') ''

How to convert UTC to EST with Python and take care of daylight saving automatically?

空扰寡人 提交于 2019-12-07 13:21:14
问题 If I have a bunch of data with date & time in UTC format , how can I convert them to EST . It can determine when they will be -4(in summer) and - 5(in winter) automatically every year? Thanks 回答1: You'll need to use the pytz module (available from PyPI): import pytz from datetime import datetime est = pytz.timezone('US/Eastern') utc = pytz.utc fmt = '%Y-%m-%d %H:%M:%S %Z%z' winter = datetime(2016, 1, 24, 18, 0, 0, tzinfo=utc) summer = datetime(2016, 7, 24, 18, 0, 0, tzinfo=utc) print winter

Eliminating the subtle whitespace handling difference between DateTimeFormat and Joda's DateTimeFormatter

强颜欢笑 提交于 2019-12-07 08:30:55
问题 We have some existing code like this: DateFormat[] dateFormats = { new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z", Locale.ENGLISH), new SimpleDateFormat("d MMM yyyy HH:mm:ss Z", Locale.ENGLISH) }; For thread safety reasons, I tried to convert it to use Joda Time's formatters, so: DateTimeFormatter[] dateFormats = { DateTimeFormat.forPattern("EEE, d MMM yyyy HH:mm:ss Z") .withLocale(Locale.ENGLISH) .withOffsetParsed(), DateTimeFormat.forPattern("d MMM yyyy HH:mm:ss Z") .withLocale(Locale

how to deserialize DateTime in Lift

爱⌒轻易说出口 提交于 2019-12-07 07:08:36
问题 I am having trouble deserializing a org.joda.time.DateTime field from JSON into a case class. The JSON: val ajson=parse(""" { "creationDate": "2013-01-02T10:48:41.000-05:00" }""") I also set these serialization options: implicit val formats = Serialization.formats(NoTypeHints) ++ net.liftweb.json.ext.JodaTimeSerializers.all And the deserialization: val val1=ajson.extract[Post] where Post is: case class Post( creationDate : DateTime){ ... } The exception I get is: net.liftweb.json

How to format a datetime with minimal separators and timezone in VBScript?

那年仲夏 提交于 2019-12-07 07:05:06
问题 I have the following code in C#: DateTime dt = GetDateTime(); string formatted = dt.ToString("yyyyMMddTHHmmsszz"); which returns a date in the following format: 20100806T112917+01 I would like to be able to get the same results in VBScript (for a legacy ASP application). It is especially important that I get the UTC offset information, or have the time converted to UTC. How do I do that? 回答1: For date formatting, I like using the .NET StringBuilder class from VBScript: Option Explicit Dim sb