Questions tagged [date-formatting]

Date formatting is the process of displaying, handling or converting a calendar date to a specific format.

Wikipedia goes into good detail about various date formats in its Date format by country article:

Basic components of a calendar date for the most common calendar systems:

Y – Year
M – Month
D – Day

Order of the basic components:

B – Big-endian (year, month, day), e.g. 1996-04-22
L – Little-endian (day, month, year), e.g. 22.04.96 or 22/04/96
M – Middle-endian (month, day, year), e.g. 04/22/96

Specific formats for the basic components

yyyy – Four-digit year, e.g. 1996
yy – Two-digit year, e.g. 96
mm – Two-digit month, e.g. 04
m – one-digit month for months below 10, e.g. 4
mmm – three-letter abbreviation for month
mmmm – month spelled out in full
dd – two-digit day, e.g. 02
d – one-digit day for days below 10, e.g. 2

Separators of the components

"/" – Slash
"." – Dots or full stops
"-" – Hyphens or dashes
" " – Spaces
1459 questions
23
votes
8 answers

Return date as ddmmyyyy in SQL Server

I need the date as ddmmyyyy without any spacers. How can I do this? I can get yyyymmdd using CONVERT(VARCHAR, [MyDateTime], 112) But I need the reverse of this. SQL Server 2008
Matt
  • 3,838
  • 9
  • 36
  • 61
22
votes
7 answers

Locale specific date in jekyll

I am trying out jekyll for website creation. I am using jekyll-bootstrap. The default configuration has the page archive, where all the posts are listed grouped by year and month of the post date. Currently the months appear in English. I've looked…
mpiktas
  • 9,917
  • 5
  • 39
  • 56
21
votes
9 answers

StringFormat on Binding

View: I want to format the Date to "dd/MM/yyyy", in other words, without the time. I tried it: , but it doesn't work. Gives me an error: The…
developer033
  • 20,983
  • 7
  • 64
  • 95
21
votes
6 answers

Compare two date formats in javascript/jquery

I have the following : var fit_start_time = $("#fit_start_time").val(); //2013-09-5 var fit_end_time = $("#fit_end_time").val(); //2013-09-10 if(Date.parse(fit_start_time)>=Date.parse(fit_end_time)){ alert("Please select a different End…
Roy M J
  • 6,711
  • 6
  • 43
  • 76
19
votes
9 answers

AngularJS - How do you convert milliseconds to xHours and yMins

I've a requirement where I want to convert milliseconds to xHours and yMins in AngularJS. For ex. 3600000 should be displayed as 1h 0m. I tried using date:'H:m' and date:'HH:mm' from the date formats on Angular's website. But those give 19:0 and…
Pritish
  • 749
  • 4
  • 13
  • 27
19
votes
3 answers

Is it possible to change the iOS Simulator to use 24 hour time?

I'm trying to debug a potential issue in the iOS Simulator (v 7.0) which requires the iPad to be running in 24-hour time mode. Obviously, the option is not available to change in the simulator itself and changing the time mode on my host system…
Ian McCombe
  • 205
  • 1
  • 3
  • 7
17
votes
1 answer

Force localization of the allowedUnits in DateComponentsFormatter

I have an app with only one language. I would like to force the language to be this when displaying a time interval since a date. E.g. "9 mths ago" Just in a specific language not english. Is there a way to do this using DateComponentsFormatter…
user12345625
  • 368
  • 6
  • 16
17
votes
2 answers

How to remove time-field string from a date-as-character variable?

Suppose I have a variable like this c<-c("9/21/2011 0:00:00", "9/25/2011 0:00:00", "10/2/2011 0:00:00", "9/28/2011 0:00:00", "9/27/2011 0:00:00") what's a quick way to remove all 0:00:00s so that c [1] "9/21/2011" "9/25/2011" "10/2/2011"…
David Z
  • 5,189
  • 6
  • 35
  • 74
17
votes
2 answers

Format column within dplyr chain

I have this data set: dat <- structure(list(date = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L), .Label = c("3/31/2014", "4/1/2014", "4/2/2014", "4/3/2014"), class = "factor"), site = structure(c(1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L,…
maloneypatr
  • 3,242
  • 4
  • 21
  • 32
15
votes
6 answers

How Do I Produce a Date format like "1st November" in c#

How can i get below mentions date format in c#. For 1-Nov-2010 it should be display as : 1st November For 30-Nov-2010 it should be display as : 30th November Can we do using any date format or make a custom function that returns for 1 -> 'st', 2->…
Pankaj Agarwal
  • 10,605
  • 12
  • 39
  • 58
15
votes
1 answer

Formatting Quarter time in pandas columns

I have a DataFrame with columns in DateTime index, representing quarters such as: 2000-03-31 00:00:00 How can I do to transform this into '2000q1'? I have looked around the docs, but they only say DateTimeIndex.quarter Here:…
B Furtado
  • 1,193
  • 1
  • 17
  • 28
15
votes
9 answers

Excel TEXT formula doesn't convert 'yyyy' to a year

I want to combine some text with a date in Excel 2013. Let's say I have a cell A2 with a date like 30-10-2014. I tried to append the date after the text with this formula: ="Some text and a date: "&A2 But the output shows the date as a number: Some…
Kapé
  • 3,467
  • 1
  • 30
  • 48
15
votes
2 answers

Comprehensive list of date format patterns in obj-c for iOS

Is there an actual, comprehensive list of supported date format patterns/tokens? I've been looking at the API docs, and they mention a few of them, such as MM, but where's the rest?
chinabuffet
  • 4,776
  • 7
  • 35
  • 58
14
votes
2 answers

How to get system time format when region is "United Kingdom" in ios?

I am using the following code for get system time format in ios. And it work fine when my current region set with "United State" but when I change the region from "United State" to "United Kingdom" it always give 12 hour formate. #pragma…
chirag shah
  • 2,920
  • 1
  • 26
  • 54
13
votes
2 answers

Debug.WriteLine() versus Console.WriteLine() handles culture differently. Why?

Consider the following Console App code: Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB"); Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; DateTime date = new DateTime(2014, 01,…
Matthew Watson
  • 90,570
  • 7
  • 128
  • 228
1 2
3
97 98