1 package bn_BD
2
3 import (
4 "math"
5 "strconv"
6 "time"
7
8 "github.com/go-playground/locales"
9 "github.com/go-playground/locales/currency"
10 )
11
12 type bn_BD struct {
13 locale string
14 pluralsCardinal []locales.PluralRule
15 pluralsOrdinal []locales.PluralRule
16 pluralsRange []locales.PluralRule
17 decimal string
18 group string
19 minus string
20 percent string
21 perMille string
22 timeSeparator string
23 inifinity string
24 currencies []string
25 monthsAbbreviated []string
26 monthsNarrow []string
27 monthsWide []string
28 daysAbbreviated []string
29 daysNarrow []string
30 daysShort []string
31 daysWide []string
32 periodsAbbreviated []string
33 periodsNarrow []string
34 periodsShort []string
35 periodsWide []string
36 erasAbbreviated []string
37 erasNarrow []string
38 erasWide []string
39 timezones map[string]string
40 }
41
42
43 func New() locales.Translator {
44 return &bn_BD{
45 locale: "bn_BD",
46 pluralsCardinal: []locales.PluralRule{2, 6},
47 pluralsOrdinal: []locales.PluralRule{2, 3, 4, 5, 6},
48 pluralsRange: []locales.PluralRule{2, 6},
49 decimal: ".",
50 group: ",",
51 minus: "-",
52 percent: "%",
53 perMille: "‰",
54 timeSeparator: ":",
55 inifinity: "∞",
56 currencies: []string{"ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", "ANG", "AOA", "AOK", "AON", "AOR", "ARA", "ARL", "ARM", "ARP", "ARS", "ATS", "AUD", "AWG", "AZM", "AZN", "BAD", "BAM", "BAN", "BBD", "BDT", "BEC", "BEF", "BEL", "BGL", "BGM", "BGN", "BGO", "BHD", "BIF", "BMD", "BND", "BOB", "BOL", "BOP", "BOV", "BRB", "BRC", "BRE", "BRL", "BRN", "BRR", "BRZ", "BSD", "BTN", "BUK", "BWP", "BYB", "BYN", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "CNH", "CNX", "CNY", "COP", "COU", "CRC", "CSD", "CSK", "CUC", "CUP", "CVE", "CYP", "CZK", "DDM", "DEM", "DJF", "DKK", "DOP", "DZD", "ECS", "ECV", "EEK", "EGP", "ERN", "ESA", "ESB", "ESP", "ETB", "EUR", "FIM", "FJD", "FKP", "FRF", "GBP", "GEK", "GEL", "GHC", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "HKD", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "ILS", "INR", "IQD", "IRR", "ISJ", "ISK", "ITL", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRH", "KRO", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LTT", "LUC", "LUF", "LUL", "LVL", "LVR", "LYD", "MAD", "MAF", "MCF", "MDC", "MDL", "MGA", "MGF", "MKD", "MKN", "MLF", "MMK", "MNT", "MOP", "MRO", "MRU", "MTL", "MTP", "MUR", "MVP", "MVR", "MWK", "MXN", "MXP", "MXV", "MYR", "MZE", "MZM", "MZN", "NAD", "NGN", "NIC", "NIO", "NLG", "NOK", "NPR", "NZD", "OMR", "PAB", "PEI", "PEN", "PES", "PGK", "PHP", "PKR", "PLN", "PLZ", "PTE", "PYG", "QAR", "RHD", "ROL", "RON", "RSD", "RUB", "RUR", "RWF", "SAR", "SBD", "SCR", "SDD", "SDG", "SDP", "SEK", "SGD", "SHP", "SIT", "SKK", "SLL", "SOS", "SRD", "SRG", "SSP", "STD", "STN", "SUR", "SVC", "SYP", "SZL", "THB", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TRY", "TTD", "TWD", "TZS", "UAH", "UAK", "UGS", "UGX", "USD", "USN", "USS", "UYI", "UYP", "UYU", "UYW", "UZS", "VEB", "VEF", "VES", "VND", "VNN", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XEU", "XFO", "XFU", "XOF", "XPD", "XPF", "XPT", "XRE", "XSU", "XTS", "XUA", "XXX", "YDD", "YER", "YUD", "YUM", "YUN", "YUR", "ZAL", "ZAR", "ZMK", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
57 monthsAbbreviated: []string{"", "জানু", "ফেব", "মার্চ", "এপ্রিল", "মে", "জুন", "জুলাই", "আগস্ট", "সেপ্টেম্বর", "অক্টোবর", "নভেম্বর", "ডিসেম্বর"},
58 monthsNarrow: []string{"", "জা", "ফে", "মা", "এ", "মে", "জুন", "জু", "আ", "সে", "অ", "ন", "ডি"},
59 monthsWide: []string{"", "জানুয়ারী", "ফেব্রুয়ারী", "মার্চ", "এপ্রিল", "মে", "জুন", "জুলাই", "আগস্ট", "সেপ্টেম্বর", "অক্টোবর", "নভেম্বর", "ডিসেম্বর"},
60 daysAbbreviated: []string{"রবি", "সোম", "মঙ্গল", "বুধ", "বৃহস্পতি", "শুক্র", "শনি"},
61 daysNarrow: []string{"র", "সো", "ম", "বু", "বৃ", "শু", "শ"},
62 daysShort: []string{"রঃ", "সোঃ", "মঃ", "বুঃ", "বৃঃ", "শুঃ", "শনি"},
63 daysWide: []string{"রবিবার", "সোমবার", "মঙ্গলবার", "বুধবার", "বৃহস্পতিবার", "শুক্রবার", "শনিবার"},
64 periodsAbbreviated: []string{"AM", "PM"},
65 periodsNarrow: []string{"AM", "PM"},
66 periodsWide: []string{"AM", "PM"},
67 erasAbbreviated: []string{"খ্রিস্টপূর্ব", "খৃষ্টাব্দ"},
68 erasNarrow: []string{"", ""},
69 erasWide: []string{"খ্রিস্টপূর্ব", "খ্রীষ্টাব্দ"},
70 timezones: map[string]string{"ACDT": "অস্ট্রেলীয় কেন্দ্রীয় দিবালোক সময়", "ACST": "অস্ট্রেলীয় কেন্দ্রীয় মানক সময়", "ACWDT": "অস্ট্রেলীয় কেন্দ্রীয় পশ্চিমি দিবালোক সময়", "ACWST": "অস্ট্রেলীয় কেন্দ্রীয় পশ্চিমি মানক সময়", "ADT": "অতলান্তিক দিবালোক সময়", "AEDT": "অস্ট্রেলীয় পূর্ব দিবালোক সময়", "AEST": "অস্ট্রেলীয় পূর্ব মানক সময়", "AKDT": "আলাস্কা দিবালোক সময়", "AKST": "আলাস্কা মানক সময়", "ARST": "আর্জেন্টিনা গ্রীষ্মকালীন সময়", "ART": "আর্জেন্টিনা মানক সময়", "AST": "অতলান্তিক মানক সময়", "AWDT": "অস্ট্রেলীয় পশ্চিমি দিবালোক সময়", "AWST": "অস্ট্রেলীয় পশ্চিমি মানক সময়", "BOT": "বোলিভিয়া সময়", "BT": "ভুটান সময়", "CAT": "মধ্য আফ্রিকা সময়", "CDT": "কেন্দ্রীয় দিবালোক সময়", "CHADT": "চ্যাথাম দিবালোক সময়", "CHAST": "চ্যাথাম মানক সময়", "CLST": "চিলি গ্রীষ্মকালীন সময়", "CLT": "চিলি মানক সময়", "COST": "কোলোম্বিয়া গ্রীষ্মকালীন সময়", "COT": "কোলোম্বিয়া মানক সময়", "CST": "কেন্দ্রীয় মানক সময়", "ChST": "চামেরো মানক সময়", "EAT": "পূর্ব আফ্রিকা সময়", "ECT": "ইকুয়েডর সময়", "EDT": "পূর্বাঞ্চলের দিবালোক সময়", "EST": "পূর্বাঞ্চলের প্রমাণ সময়", "GFT": "ফরাসি গায়ানা সময়", "GMT": "গ্রীনিচ মিন টাইম", "GST": "উপসাগরীয় মানক সময়", "GYT": "গুয়ানা সময়", "HADT": "হাওয়াই-আলেউত দিবালোক সময়", "HAST": "হাওয়াই-আলেউত মানক সময়", "HAT": "নিউফাউন্ডল্যান্ড দিবালোক সময়", "HECU": "কিউবা দিবালোক সময়", "HEEG": "পূর্ব গ্রীনল্যান্ড গ্রীষ্মকালীন সময়", "HENOMX": "উত্তরপশ্চিম মেক্সিকোর দিনের সময়", "HEOG": "পশ্চিম গ্রীনল্যান্ড গ্রীষ্মকালীন সময়", "HEPM": "সেন্ট পিয়ের ও মিকেলন দিবালোক সময়", "HEPMX": "মেক্সিকান প্রশান্ত মহাসাগরীয় দিবালোক সময়", "HKST": "হং কং গ্রীষ্মকালীন সময়", "HKT": "হং কং মানক সময়", "HNCU": "কিউবা মানক সময়", "HNEG": "পূর্ব গ্রীনল্যান্ড মানক সময়", "HNNOMX": "উত্তরপশ্চিম মেক্সিকোর মানক সময়", "HNOG": "পশ্চিম গ্রীনল্যান্ড মানক সময়", "HNPM": "সেন্ট পিয়ের ও মিকেলন মানক সময়", "HNPMX": "মেক্সিকান প্রশান্ত মহসাগরীয় মানক সময়", "HNT": "নিউফাউন্ডল্যান্ড মানক সময়", "IST": "ভারতীয় মানক সময়", "JDT": "জাপান দিবালোক সময়", "JST": "জাপান মানক সময়", "LHDT": "লর্ড হাওয়ে দিবালোক মসয়", "LHST": "লর্ড হাওয়ে মানক মসয়", "MDT": "পার্বত্য অঞ্চলের দিনের সময়", "MESZ": "মধ্য ইউরোপীয় গ্রীষ্মকালীন সময়", "MEZ": "মধ্য ইউরোপীয় মানক সময়", "MST": "পার্বত্য অঞ্চলের প্রমাণ সময়", "MYT": "মালয়েশিয়া সময়", "NZDT": "নিউজিল্যান্ড দিবালোক সময়", "NZST": "নিউজিল্যান্ড মানক সময়", "OESZ": "পূর্ব ইউরোপীয় গ্রীষ্মকালীন সময়", "OEZ": "পূর্ব ইউরোপীয় মানক সময়", "PDT": "প্রশান্ত মহাসাগরীয় অঞ্চলের দিনের সময়", "PST": "প্রশান্ত মহাসাগরীয় অঞ্চলের মানক সময়", "SAST": "দক্ষিণ আফ্রিকা মানক সময়", "SGT": "সিঙ্গাপুর মানক সময়", "SRT": "সুরিনাম সময়", "TMST": "তুর্কমেনিস্তান গ্রীষ্মকালীন সময়", "TMT": "তুর্কমেনিস্তান মানক সময়", "UYST": "উরুগুয়ে গ্রীষ্মকালীন সময়", "UYT": "উরুগুয়ে মানক সময়", "VET": "ভেনেজুয়েলা সময়", "WARST": "পশ্চিমি আর্জেনটিনা গ্রীষ্মকালীন সময়", "WART": "পশ্চিমি আর্জেনটিনার প্রমাণ সময়", "WAST": "পশ্চিম আফ্রিকা গ্রীষ্মকালীন সময়", "WAT": "পশ্চিম আফ্রিকা মানক সময়", "WESZ": "পশ্চিম ইউরোপীয় গ্রীষ্মকালীন সময়", "WEZ": "পশ্চিম ইউরোপীয় মানক সময়", "WIB": "পশ্চিমী ইন্দোনেশিয়া সময়", "WIT": "পূর্ব ইন্দোনেশিয়া সময়", "WITA": "কেন্দ্রীয় ইন্দোনেশিয়া সময়", "∅∅∅": "পেরু গ্রীষ্মকালীন সময়"},
71 }
72 }
73
74
75 func (bn *bn_BD) Locale() string {
76 return bn.locale
77 }
78
79
80 func (bn *bn_BD) PluralsCardinal() []locales.PluralRule {
81 return bn.pluralsCardinal
82 }
83
84
85 func (bn *bn_BD) PluralsOrdinal() []locales.PluralRule {
86 return bn.pluralsOrdinal
87 }
88
89
90 func (bn *bn_BD) PluralsRange() []locales.PluralRule {
91 return bn.pluralsRange
92 }
93
94
95 func (bn *bn_BD) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
96
97 n := math.Abs(num)
98 i := int64(n)
99
100 if (i == 0) || (n == 1) {
101 return locales.PluralRuleOne
102 }
103
104 return locales.PluralRuleOther
105 }
106
107
108 func (bn *bn_BD) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
109
110 n := math.Abs(num)
111
112 if n == 1 || n == 5 || n == 7 || n == 8 || n == 9 || n == 10 {
113 return locales.PluralRuleOne
114 } else if n == 2 || n == 3 {
115 return locales.PluralRuleTwo
116 } else if n == 4 {
117 return locales.PluralRuleFew
118 } else if n == 6 {
119 return locales.PluralRuleMany
120 }
121
122 return locales.PluralRuleOther
123 }
124
125
126 func (bn *bn_BD) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
127
128 start := bn.CardinalPluralRule(num1, v1)
129 end := bn.CardinalPluralRule(num2, v2)
130
131 if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
132 return locales.PluralRuleOne
133 } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
134 return locales.PluralRuleOther
135 }
136
137 return locales.PluralRuleOther
138
139 }
140
141
142 func (bn *bn_BD) MonthAbbreviated(month time.Month) string {
143 return bn.monthsAbbreviated[month]
144 }
145
146
147 func (bn *bn_BD) MonthsAbbreviated() []string {
148 return bn.monthsAbbreviated[1:]
149 }
150
151
152 func (bn *bn_BD) MonthNarrow(month time.Month) string {
153 return bn.monthsNarrow[month]
154 }
155
156
157 func (bn *bn_BD) MonthsNarrow() []string {
158 return bn.monthsNarrow[1:]
159 }
160
161
162 func (bn *bn_BD) MonthWide(month time.Month) string {
163 return bn.monthsWide[month]
164 }
165
166
167 func (bn *bn_BD) MonthsWide() []string {
168 return bn.monthsWide[1:]
169 }
170
171
172 func (bn *bn_BD) WeekdayAbbreviated(weekday time.Weekday) string {
173 return bn.daysAbbreviated[weekday]
174 }
175
176
177 func (bn *bn_BD) WeekdaysAbbreviated() []string {
178 return bn.daysAbbreviated
179 }
180
181
182 func (bn *bn_BD) WeekdayNarrow(weekday time.Weekday) string {
183 return bn.daysNarrow[weekday]
184 }
185
186
187 func (bn *bn_BD) WeekdaysNarrow() []string {
188 return bn.daysNarrow
189 }
190
191
192 func (bn *bn_BD) WeekdayShort(weekday time.Weekday) string {
193 return bn.daysShort[weekday]
194 }
195
196
197 func (bn *bn_BD) WeekdaysShort() []string {
198 return bn.daysShort
199 }
200
201
202 func (bn *bn_BD) WeekdayWide(weekday time.Weekday) string {
203 return bn.daysWide[weekday]
204 }
205
206
207 func (bn *bn_BD) WeekdaysWide() []string {
208 return bn.daysWide
209 }
210
211
212 func (bn *bn_BD) Decimal() string {
213 return bn.decimal
214 }
215
216
217 func (bn *bn_BD) Group() string {
218 return bn.group
219 }
220
221
222 func (bn *bn_BD) Minus() string {
223 return bn.minus
224 }
225
226
227 func (bn *bn_BD) FmtNumber(num float64, v uint64) string {
228
229 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
230 l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
231 count := 0
232 inWhole := v == 0
233 inSecondary := false
234 groupThreshold := 3
235
236 b := make([]byte, 0, l)
237
238 for i := len(s) - 1; i >= 0; i-- {
239
240 if s[i] == '.' {
241 b = append(b, bn.decimal[0])
242 inWhole = true
243 continue
244 }
245
246 if inWhole {
247
248 if count == groupThreshold {
249 b = append(b, bn.group[0])
250 count = 1
251
252 if !inSecondary {
253 inSecondary = true
254 groupThreshold = 2
255 }
256 } else {
257 count++
258 }
259 }
260
261 b = append(b, s[i])
262 }
263
264 if num < 0 {
265 b = append(b, bn.minus[0])
266 }
267
268
269 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
270 b[i], b[j] = b[j], b[i]
271 }
272
273 return string(b)
274 }
275
276
277
278 func (bn *bn_BD) FmtPercent(num float64, v uint64) string {
279 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
280 l := len(s) + 3
281 b := make([]byte, 0, l)
282
283 for i := len(s) - 1; i >= 0; i-- {
284
285 if s[i] == '.' {
286 b = append(b, bn.decimal[0])
287 continue
288 }
289
290 b = append(b, s[i])
291 }
292
293 if num < 0 {
294 b = append(b, bn.minus[0])
295 }
296
297
298 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
299 b[i], b[j] = b[j], b[i]
300 }
301
302 b = append(b, bn.percent...)
303
304 return string(b)
305 }
306
307
308 func (bn *bn_BD) FmtCurrency(num float64, v uint64, currency currency.Type) string {
309
310 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
311 symbol := bn.currencies[currency]
312 l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
313 count := 0
314 inWhole := v == 0
315 inSecondary := false
316 groupThreshold := 3
317
318 b := make([]byte, 0, l)
319
320 for i := len(s) - 1; i >= 0; i-- {
321
322 if s[i] == '.' {
323 b = append(b, bn.decimal[0])
324 inWhole = true
325 continue
326 }
327
328 if inWhole {
329
330 if count == groupThreshold {
331 b = append(b, bn.group[0])
332 count = 1
333
334 if !inSecondary {
335 inSecondary = true
336 groupThreshold = 2
337 }
338 } else {
339 count++
340 }
341 }
342
343 b = append(b, s[i])
344 }
345
346 if num < 0 {
347 b = append(b, bn.minus[0])
348 }
349
350
351 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
352 b[i], b[j] = b[j], b[i]
353 }
354
355 if int(v) < 2 {
356
357 if v == 0 {
358 b = append(b, bn.decimal...)
359 }
360
361 for i := 0; i < 2-int(v); i++ {
362 b = append(b, '0')
363 }
364 }
365
366 b = append(b, symbol...)
367
368 return string(b)
369 }
370
371
372
373 func (bn *bn_BD) FmtAccounting(num float64, v uint64, currency currency.Type) string {
374
375 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
376 symbol := bn.currencies[currency]
377 l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
378 count := 0
379 inWhole := v == 0
380 inSecondary := false
381 groupThreshold := 3
382
383 b := make([]byte, 0, l)
384
385 for i := len(s) - 1; i >= 0; i-- {
386
387 if s[i] == '.' {
388 b = append(b, bn.decimal[0])
389 inWhole = true
390 continue
391 }
392
393 if inWhole {
394
395 if count == groupThreshold {
396 b = append(b, bn.group[0])
397 count = 1
398
399 if !inSecondary {
400 inSecondary = true
401 groupThreshold = 2
402 }
403 } else {
404 count++
405 }
406 }
407
408 b = append(b, s[i])
409 }
410
411 if num < 0 {
412
413 b = append(b, bn.minus[0])
414
415 }
416
417
418 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
419 b[i], b[j] = b[j], b[i]
420 }
421
422 if int(v) < 2 {
423
424 if v == 0 {
425 b = append(b, bn.decimal...)
426 }
427
428 for i := 0; i < 2-int(v); i++ {
429 b = append(b, '0')
430 }
431 }
432
433 if num < 0 {
434 b = append(b, symbol...)
435 } else {
436
437 b = append(b, symbol...)
438 }
439
440 return string(b)
441 }
442
443
444 func (bn *bn_BD) FmtDateShort(t time.Time) string {
445
446 b := make([]byte, 0, 32)
447
448 b = strconv.AppendInt(b, int64(t.Day()), 10)
449 b = append(b, []byte{0x2f}...)
450 b = strconv.AppendInt(b, int64(t.Month()), 10)
451 b = append(b, []byte{0x2f}...)
452
453 if t.Year() > 9 {
454 b = append(b, strconv.Itoa(t.Year())[2:]...)
455 } else {
456 b = append(b, strconv.Itoa(t.Year())[1:]...)
457 }
458
459 return string(b)
460 }
461
462
463 func (bn *bn_BD) FmtDateMedium(t time.Time) string {
464
465 b := make([]byte, 0, 32)
466
467 b = strconv.AppendInt(b, int64(t.Day()), 10)
468 b = append(b, []byte{0x20}...)
469 b = append(b, bn.monthsAbbreviated[t.Month()]...)
470 b = append(b, []byte{0x2c, 0x20}...)
471
472 if t.Year() > 0 {
473 b = strconv.AppendInt(b, int64(t.Year()), 10)
474 } else {
475 b = strconv.AppendInt(b, int64(-t.Year()), 10)
476 }
477
478 return string(b)
479 }
480
481
482 func (bn *bn_BD) FmtDateLong(t time.Time) string {
483
484 b := make([]byte, 0, 32)
485
486 b = strconv.AppendInt(b, int64(t.Day()), 10)
487 b = append(b, []byte{0x20}...)
488 b = append(b, bn.monthsWide[t.Month()]...)
489 b = append(b, []byte{0x2c, 0x20}...)
490
491 if t.Year() > 0 {
492 b = strconv.AppendInt(b, int64(t.Year()), 10)
493 } else {
494 b = strconv.AppendInt(b, int64(-t.Year()), 10)
495 }
496
497 return string(b)
498 }
499
500
501 func (bn *bn_BD) FmtDateFull(t time.Time) string {
502
503 b := make([]byte, 0, 32)
504
505 b = append(b, bn.daysWide[t.Weekday()]...)
506 b = append(b, []byte{0x2c, 0x20}...)
507 b = strconv.AppendInt(b, int64(t.Day()), 10)
508 b = append(b, []byte{0x20}...)
509 b = append(b, bn.monthsWide[t.Month()]...)
510 b = append(b, []byte{0x2c, 0x20}...)
511
512 if t.Year() > 0 {
513 b = strconv.AppendInt(b, int64(t.Year()), 10)
514 } else {
515 b = strconv.AppendInt(b, int64(-t.Year()), 10)
516 }
517
518 return string(b)
519 }
520
521
522 func (bn *bn_BD) FmtTimeShort(t time.Time) string {
523
524 b := make([]byte, 0, 32)
525
526 h := t.Hour()
527
528 if h > 12 {
529 h -= 12
530 }
531
532 b = strconv.AppendInt(b, int64(h), 10)
533 b = append(b, bn.timeSeparator...)
534
535 if t.Minute() < 10 {
536 b = append(b, '0')
537 }
538
539 b = strconv.AppendInt(b, int64(t.Minute()), 10)
540 b = append(b, []byte{0x20}...)
541
542 if t.Hour() < 12 {
543 b = append(b, bn.periodsAbbreviated[0]...)
544 } else {
545 b = append(b, bn.periodsAbbreviated[1]...)
546 }
547
548 return string(b)
549 }
550
551
552 func (bn *bn_BD) FmtTimeMedium(t time.Time) string {
553
554 b := make([]byte, 0, 32)
555
556 h := t.Hour()
557
558 if h > 12 {
559 h -= 12
560 }
561
562 b = strconv.AppendInt(b, int64(h), 10)
563 b = append(b, bn.timeSeparator...)
564
565 if t.Minute() < 10 {
566 b = append(b, '0')
567 }
568
569 b = strconv.AppendInt(b, int64(t.Minute()), 10)
570 b = append(b, bn.timeSeparator...)
571
572 if t.Second() < 10 {
573 b = append(b, '0')
574 }
575
576 b = strconv.AppendInt(b, int64(t.Second()), 10)
577 b = append(b, []byte{0x20}...)
578
579 if t.Hour() < 12 {
580 b = append(b, bn.periodsAbbreviated[0]...)
581 } else {
582 b = append(b, bn.periodsAbbreviated[1]...)
583 }
584
585 return string(b)
586 }
587
588
589 func (bn *bn_BD) FmtTimeLong(t time.Time) string {
590
591 b := make([]byte, 0, 32)
592
593 h := t.Hour()
594
595 if h > 12 {
596 h -= 12
597 }
598
599 b = strconv.AppendInt(b, int64(h), 10)
600 b = append(b, bn.timeSeparator...)
601
602 if t.Minute() < 10 {
603 b = append(b, '0')
604 }
605
606 b = strconv.AppendInt(b, int64(t.Minute()), 10)
607 b = append(b, bn.timeSeparator...)
608
609 if t.Second() < 10 {
610 b = append(b, '0')
611 }
612
613 b = strconv.AppendInt(b, int64(t.Second()), 10)
614 b = append(b, []byte{0x20}...)
615
616 if t.Hour() < 12 {
617 b = append(b, bn.periodsAbbreviated[0]...)
618 } else {
619 b = append(b, bn.periodsAbbreviated[1]...)
620 }
621
622 b = append(b, []byte{0x20}...)
623
624 tz, _ := t.Zone()
625 b = append(b, tz...)
626
627 return string(b)
628 }
629
630
631 func (bn *bn_BD) FmtTimeFull(t time.Time) string {
632
633 b := make([]byte, 0, 32)
634
635 h := t.Hour()
636
637 if h > 12 {
638 h -= 12
639 }
640
641 b = strconv.AppendInt(b, int64(h), 10)
642 b = append(b, bn.timeSeparator...)
643
644 if t.Minute() < 10 {
645 b = append(b, '0')
646 }
647
648 b = strconv.AppendInt(b, int64(t.Minute()), 10)
649 b = append(b, bn.timeSeparator...)
650
651 if t.Second() < 10 {
652 b = append(b, '0')
653 }
654
655 b = strconv.AppendInt(b, int64(t.Second()), 10)
656 b = append(b, []byte{0x20}...)
657
658 if t.Hour() < 12 {
659 b = append(b, bn.periodsAbbreviated[0]...)
660 } else {
661 b = append(b, bn.periodsAbbreviated[1]...)
662 }
663
664 b = append(b, []byte{0x20}...)
665
666 tz, _ := t.Zone()
667
668 if btz, ok := bn.timezones[tz]; ok {
669 b = append(b, btz...)
670 } else {
671 b = append(b, tz...)
672 }
673
674 return string(b)
675 }
676
View as plain text