Conversion of dates from one calendar or notation to another, for example, converting Julian calendar February 29, 1700 to Gregorian calendar March 11, 1700, or "March 11, 1700" to "1700-03-11".
Questions tagged [date-conversion]
688 questions
17
votes
2 answers
Converting date in Year.decimal form in R
I have a ts column that saves years in decimal format ie
1988.0
1988.25
1988.5
1988.75
and so on. I need to export it to a .csv file with the date in a "DD-MM-YYYY" format.
How do I do this?

monkeyshines
- 1,058
- 2
- 8
- 25
17
votes
5 answers
sql server Get the FULL month name from a date
How do I use sql to get the whole month name in sql server?
I did't find a way using DATEPART(mm, mydate) or CONVERT(VARCHAR(12), CreatedFor, 107).
Basically I need in the format: April 1 2009.

Neville Nazerane
- 6,622
- 3
- 46
- 79
16
votes
7 answers
converting gregorian to hijri date
I want to convert from Gregorian to Hijri(Islamic) date and I need a java class for this converting. I want to give it an Gregorian date in format of "yyyy/mm/dd" as string and it give me the Hijri date in the same format. can anyone help me?

anony
- 247
- 1
- 3
- 11
15
votes
7 answers
Truncating java.util.Date to LocalDate *without* toInstant() because java.sql.Date gives UnsupportedOperationException
If I use java.util.Date's toInstant() on a variable which happens to be a java.sql.Date, I get an UnsupportedOperationException.
try {
java.util.Date input = new java.sql.Date(System.currentTimeMillis());
LocalDate date =…

Adam
- 5,215
- 5
- 51
- 90
14
votes
3 answers
Timestamp to ISO 8601 in Lua
How would you convert a timestamp to an ISO 8601 format (such as 2009-01-28T21:49:59.000Z) in Lua?
I'm specifically trying to do it by using the HttpLuaModule in Nginx.

Mark
- 67,098
- 47
- 117
- 162
13
votes
5 answers
Convert seconds to days, hours, minutes, seconds (MySQL)
Example:
seconds ="1015557";
Result should be:
11days 18h:05m:57s
How can do this in MySQL?

Zameer Ahmed
- 131
- 1
- 2
- 7
12
votes
2 answers
Convert dd/MM/yyyy to MM/dd/YYYY
I need to convert "28/08/2012" to MM/dd/YYYY format that means "08/28/2012".
How can I do that?
I am using below code , but it threw exception to me.
DateTime.ParseExact("28/08/2012", "ddMMyyyy", CultureInfo.InvariantCulture)

Lajja Thaker
- 2,031
- 8
- 33
- 53
11
votes
4 answers
In SQL Server, how to convert a date to a string in format M/D/YYYY? (no leading zeros, not MM/DD/YYYY)
Right now, my code has the following conversion for a date field:
convert(varchar, Citation.PublishedOn, 101)
However, that returns dates like 03/01/2010. The request was to have the dates display as 3/1/2010 (without the leading zeros, but with a…

thursdaysgeek
- 7,696
- 20
- 78
- 115
11
votes
5 answers
How to get datepicker value in date format?
I have a problem with my Datapicker
i use the code for getting date,month & year shown below
DatePicker datePicker;
datePicker = (DatePicker) findViewById(R.id.dateselect);
int day = datePicker.getDayOfMonth();
…

Sibin Francis
- 581
- 2
- 12
- 30
10
votes
11 answers
Date and time conversion to some other Timezone in java
i have written this code to convert the current system date and time to some other timezone. I am not getting any error but i am not getting my output as expected. Like if i execute my program at a particular time.. My output is ::
The current time…

Shantanu Tomar
- 1,572
- 7
- 38
- 64
10
votes
4 answers
How to convert a "HH:MM:SS" string to seconds with PHP?
Is there a native way of doing "HH:MM:SS" to seconds with PHP 5.3 rather than doing a split on the colon's and multipling out each section the relevant number to calculate the seconds?
For example in Python you can do :
string time =…

benjisail
- 1,646
- 5
- 21
- 35
9
votes
5 answers
Converting Numbers from Western Arabic Digits "1,2,3..." to Eastern Arabic Digits "١, ٢, ٣...."
I need to convert date stored in database into Hijri and display the same in Arabic
I used the Culture to convert the date which it does but it still display date as English numbers
Example
Gregorian Date = 19/01/2012
Its equivalent date in Hirji…

Learning
- 19,469
- 39
- 180
- 373
9
votes
3 answers
Date Conversion with ThreadLocal
I have a requirement to convert incoming date string format "20130212" (YYYYMMDD) to 12/02/2013 (DD/MM/YYYY)
using ThreadLocal. I know a way to do this without the ThreadLocal. Can anyone help me?
Conversion without ThreadLocal:
final…

user2680017
- 101
- 1
- 2
- 9
7
votes
2 answers
How to convert a Gregorian date to Julian date with the Java 8 Date/Time API?
I have a date in the Gregorian calendar and want to look up the same day in the Julian calendar.
This should be easy with the Date/Time API of Java 8 but I couldn't find a way to do it. The code should look something like this:
/*
* LocalDate uses…

Paule
- 138
- 1
- 9
7
votes
1 answer
Is there a way to obtain a milliseconds to days conversion without losing precision and without the need to write the mathematical formula in Java?
I was using TimeUnit.MILLISECONDS.toDays(ms) to convert a millisecond time quantity to days but reading the JavaDoc I noticed it's based on .convert() and loses precision
Convert the given time duration in the given unit to this unit. Conversions…

sarbuLopex
- 1,777
- 1
- 15
- 22