date-formatting

Django - change default presentation format of model date field

情到浓时终转凉″ 提交于 2020-01-31 21:18:02
问题 I have a model with DateField, set like this : date = models.DateField(blank=False, default=datetime.now) each time I put that field data in a tamplate ( {{obj.date}} ) it shown in this format : July 24, 2014 and I want to change that permanently to this format: 24.7.2014 also I have a search page where data can be searched by its date field - I want to be able to search in this format as well. How can I do that? EDIT: I think it has somthing to do with the LANGUAGE_CODE = 'en-us' setting.

Django - change default presentation format of model date field

天涯浪子 提交于 2020-01-31 21:16:42
问题 I have a model with DateField, set like this : date = models.DateField(blank=False, default=datetime.now) each time I put that field data in a tamplate ( {{obj.date}} ) it shown in this format : July 24, 2014 and I want to change that permanently to this format: 24.7.2014 also I have a search page where data can be searched by its date field - I want to be able to search in this format as well. How can I do that? EDIT: I think it has somthing to do with the LANGUAGE_CODE = 'en-us' setting.

Django - change default presentation format of model date field

[亡魂溺海] 提交于 2020-01-31 21:16:02
问题 I have a model with DateField, set like this : date = models.DateField(blank=False, default=datetime.now) each time I put that field data in a tamplate ( {{obj.date}} ) it shown in this format : July 24, 2014 and I want to change that permanently to this format: 24.7.2014 also I have a search page where data can be searched by its date field - I want to be able to search in this format as well. How can I do that? EDIT: I think it has somthing to do with the LANGUAGE_CODE = 'en-us' setting.

Input with date format set from ViewModel and html class attribute

淺唱寂寞╮ 提交于 2020-01-24 04:52:10
问题 I am working with razor view engine in asp.net mvc3. Now, I need an input for a DateTime which should display the value in a fixed format (say dd-MMM-yyyy ). So I can do: [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd-MMM-yyyy}")] public DateTime StartDate { get; set; } And in the view: @Html.EditorFor(model => model.StartDate) But I need to add a class in the input. Which I think is not possible in EditorFor . So I could use @Html.TextBoxFor(model => model.StartDate,

bulk insert a date in YYYYMM format to date field in MS SQL table

有些话、适合烂在心里 提交于 2020-01-10 05:47:06
问题 I have a large text file (more than 300 million records). There is a field containing date in YYYYMM format. Target field is of date type and I'm using MS SQL 2008 R2 server. Due to huge amount of data I'd prefer to use bulk insert. Here's what I've already done: bulk insert Tabela_5 from 'c:\users\...\table5.csv' with ( rowterminator = '\n', fieldterminator = ',', tablock ) select * from Tabela_5 201206 in file turns out to be 2020-12-06 on server, whereas I'd like it to be 2012-06-01 (I don

DateUtils.formatDateRange() issues when formatting date range

风流意气都作罢 提交于 2020-01-07 01:49:56
问题 In my app, I receive dates from a webservice in the form yyyy-MM-dd (e.g. 2016-03-05 ) and I need to format them as [abbreviated month] [date], e.g. Mar 5 . Additionally, I have a start and end date and want to show them as a date range, unless both dates are the same. Currently I'm using DateUtils.formatDateRange(), which should take care of my requirements and provide proper localization, but I'm running into two problems: When my end date is the day after my start date, formatDateRange()

Converting Date in M d, Y format leads to display date in other rows

戏子无情 提交于 2020-01-05 05:42:25
问题 We are fetching values of column "due_date" & displaying in site. Its working fine with help of below code. $i = 0; foreach($order as $orderData) { $k = 0; while ($k < count($orderitemsarray)) { if ($orderitemsarray[$k] != '0') { if($accountType == "admin") { $due_date=''; while($datas = $stmt1->fetch()) { $due_date=$datas['due_date']; $oDate1 = new DateTime($datas['due_date']); $sDate1 = $oDate1->format("M d, Y"); } $responce[] = array( $due_date ); } return json_encode($responce); script

Change the regional settings format for Sysem.Variants.VarToWideStr

孤者浪人 提交于 2020-01-04 09:36:25
问题 A third party component (FastReports) on my application is using extensively the System.Variants.VarToWideStr function, which is fine except that it ignores the regional settings I need that application to use. Example: FormatSettings.ShortDateFormat := 'dd/mm/yyyy'; ShowMessage(VarToWideStr(Date)); FormatSettings.ShortDateFormat := 'yyyy/mm/dd'; ShowMessage(VarToWideStr(Date)); This code always returns the same string, ignoring the regional settings that I indicate the application to use. Do

Custom date format for textbox

主宰稳场 提交于 2020-01-02 10:33:12
问题 Related: Binding 3 textboxes together; same DateTime different format I have three textboxes , all are supposed to be bound together with the same date. Two of them have normal string formats. The third one has a specific format of yyyy,jjj/HHmmss . I can't figure out how to bind this textbox to the custom format I have, and make it so if I change any of the date values in it, the other textboxes will update and vice versa. private DateTime _dateInViewModel; public DateTime DateInViewModel {

how to change date format on this html user form

南笙酒味 提交于 2019-12-31 06:15:13
问题 I have the html form which enter data into mysql DB, but in input field of date it has this format, (mm/dd/yyyy) BUT I prefer to use this format on entering date (dd/mm/yyyy) Can any body help to change the format. Here the HTML form <html> <head> <body><p>Admition number:<br> <input type="text" class="idNum" id="idnumber" onkeyup="javascript:capitalize(this.id, this.value);" name="idnumber" size="20"> <br /> Former school:<br> <input type="text" id="former_school" onkeyup="javascript