dIvYaNsH sInGh
dIvYaNsH sInGh

Reputation: 1993

Culture conversion of datetime in javascript/jquery

I want to convert the datetime format according to the culture through javaScript/jQuery.

Ex: Let we have a date:

var starDate = "7/4/2013 9:00:00 AM"

then after conversion this into french it should be "4 juillet 2013 09:00"

like we have in c#:

DateTime dteStartTime = "7/4/2013 9:00:00 AM";
dteStartTime.ToString("f", CultureInfo.CreateSpecificCulture("fr-CA"));

it will convert this datetime into "4 juillet 2013 09:00"

Upvotes: 0

Views: 2513

Answers (2)

Daemon025
Daemon025

Reputation: 87

You can do this by using the globalize.js. Just make sure you pass a correct culture code. Maybe it will better idea just to pass the converted date from C# as string?

Upvotes: 0

Cymen
Cymen

Reputation: 14419

Working with dates in JavaScript without a helper library is very painful and error prone. Have you tried using Moment.js? It has support for many languages including French (Canada).

Upvotes: 4

Related Questions